src/backend/utils/sort/logtape.c
/*
 * Record a data block number in a logical tape's lowest indirect block,
 * or record an indirect block's number in the next higher indirect level.
 */
Record a data block number in a logical tape's lowest indirect block,
or record an indirect block's number in the next higher indirect level.
Record a data block number in a logical tape ' s lowest indirect block or record an indirect block ' s number in the next higher indirect level .
static void
ltsRecordBlockNum(LogicalTapeSet *lts, IndirectBlock *indirect,
				  long blocknum)
{
	if (indirect->nextSlot >= BLOCKS_PER_INDIR_BLOCK)
	{
		long		indirblock = ltsGetFreeBlock(lts);
		ltsWriteBlock(lts, indirblock, (void *) indirect->ptrs);
		if (indirect->nextup == NULL)
		{
			indirect->nextup = (IndirectBlock *) palloc(sizeof(IndirectBlock));
			indirect->nextup->nextSlot = 0;
			indirect->nextup->nextup = NULL;
		}
		ltsRecordBlockNum(lts, indirect->nextup, indirblock);
		indirect->nextSlot = 0;
	}
	indirect->ptrs[indirect->nextSlot++] = blocknum;
}
static void ltsRecordBlockNum ( LogicalTapeSet * lts , IndirectBlock * indirect , long blocknum ) { if ( indirect -> nextSlot >= BLOCKS_PER_INDIR_BLOCK ) { long indirblock = ltsGetFreeBlock ( lts ) ; ltsWriteBlock ( lts , indirblock , ( void * ) indirect -> ptrs ) ; if ( indirect -> nextup == NULL ) { indirect -> nextup = ( IndirectBlock * ) palloc ( sizeof ( IndirectBlock ) ) ; indirect -> nextup -> nextSlot = 0 ; indirect -> nextup -> nextup = NULL ; } ltsRecordBlockNum ( lts , indirect -> nextup , indirblock ) ; indirect -> nextSlot = 0 ; } indirect -> ptrs [ indirect -> nextSlot ++ ] = blocknum ; }
Record a data block number in a logical tape's lowest indirect block,
 or record an indirect block's number in the next higher indirect level.
Record a data block number in a logical tape ' s lowest indirect block or record an indirect block ' s number in the next higher indirect level .
/*
		 * This indirect block is full, so dump it out and recursively save
		 * its address in the next indirection level.  Create a new
		 * indirection level if there wasn't one before.
		 */ /*
		 * Reset to fill another indirect block at this level.
		 */