64#define FSM_CATEGORIES 256
65#define FSM_CAT_STEP (BLCKSZ / FSM_CATEGORIES)
66#define MaxFSMRequestSize MaxHeapTupleSize
75#define FSM_TREE_DEPTH ((SlotsPerFSMPage >= 1626) ? 3 : 4)
77#define FSM_ROOT_LEVEL (FSM_TREE_DEPTH - 1)
78#define FSM_BOTTOM_LEVEL 0
155 Size oldSpaceAvail,
Size spaceNeeded)
172 if (search_slot != -1)
279 uint16 first_removed_slot;
298 if (first_removed_slot > 0)
348 return new_nfsmblocks;
438 elog(
ERROR,
"invalid FSM request size %zu", needed);
466 for (l = 0; l < addr.
level; l++)
743 if (restarts++ > 10000)
788 if (restarts++ > 10000)
865 start_slot = fsm_start_slot;
872 end_slot = fsm_end_slot;
878 for (slot = start_slot; slot <= end_slot; slot++)
#define InvalidBlockNumber
static bool BlockNumberIsValid(BlockNumber blockNumber)
Buffer ExtendBufferedRelTo(BufferManagerRelation bmr, ForkNumber fork, BufferAccessStrategy strategy, uint32 flags, BlockNumber extend_to, ReadBufferMode mode)
void ReleaseBuffer(Buffer buffer)
void UnlockReleaseBuffer(Buffer buffer)
void MarkBufferDirty(Buffer buffer)
void LockBuffer(Buffer buffer, int mode)
void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
Buffer ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum, ReadBufferMode mode, BufferAccessStrategy strategy)
#define BUFFER_LOCK_UNLOCK
#define BUFFER_LOCK_SHARE
#define RelationGetNumberOfBlocks(reln)
static Page BufferGetPage(Buffer buffer)
@ EB_CREATE_FORK_IF_NEEDED
#define BUFFER_LOCK_EXCLUSIVE
static bool BufferIsValid(Buffer bufnum)
void PageInit(Page page, Size pageSize, Size specialSize)
static char * PageGetContents(Page page)
static bool PageIsNew(Page page)
#define Assert(condition)
#define MaxFSMRequestSize
static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, BlockNumber start, BlockNumber end, bool *eof_p)
static FSMAddress fsm_get_child(FSMAddress parent, uint16 slot)
static const FSMAddress FSM_ROOT_ADDRESS
void FreeSpaceMapVacuumRange(Relation rel, BlockNumber start, BlockNumber end)
static bool fsm_does_block_exist(Relation rel, BlockNumber blknumber)
static uint8 fsm_space_needed_to_cat(Size needed)
static uint8 fsm_space_avail_to_cat(Size avail)
static Size fsm_space_cat_to_avail(uint8 cat)
static BlockNumber fsm_logical_to_physical(FSMAddress addr)
static FSMAddress fsm_get_parent(FSMAddress child, uint16 *slot)
BlockNumber RecordAndGetPageWithFreeSpace(Relation rel, BlockNumber oldPage, Size oldSpaceAvail, Size spaceNeeded)
static FSMAddress fsm_get_location(BlockNumber heapblk, uint16 *slot)
static Buffer fsm_extend(Relation rel, BlockNumber fsm_nblocks)
static Buffer fsm_readbuf(Relation rel, FSMAddress addr, bool extend)
void FreeSpaceMapVacuum(Relation rel)
Size GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk)
static int fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot, uint8 newValue, uint8 minValue)
void RecordPageWithFreeSpace(Relation rel, BlockNumber heapBlk, Size spaceAvail)
static BlockNumber fsm_search(Relation rel, uint8 min_cat)
void XLogRecordPageWithFreeSpace(RelFileLocator rlocator, BlockNumber heapBlk, Size spaceAvail)
BlockNumber GetPageWithFreeSpace(Relation rel, Size spaceNeeded)
static BlockNumber fsm_get_heap_blk(FSMAddress addr, uint16 slot)
BlockNumber FreeSpaceMapPrepareTruncateRel(Relation rel, BlockNumber nblocks)
uint8 fsm_get_avail(Page page, int slot)
uint8 fsm_get_max_avail(Page page)
bool fsm_set_avail(Page page, int slot, uint8 value)
bool fsm_truncate_avail(Page page, int nslots)
int fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext, bool exclusive_lock_held)
#define START_CRIT_SECTION()
#define CHECK_FOR_INTERRUPTS()
#define END_CRIT_SECTION()
static SMgrRelation RelationGetSmgr(Relation rel)
#define RelationNeedsWAL(relation)
BlockNumber smgrnblocks(SMgrRelation reln, ForkNumber forknum)
bool smgrexists(SMgrRelation reln, ForkNumber forknum)
BlockNumber smgr_cached_nblocks[MAX_FORKNUM+1]
#define XLogHintBitIsNeeded()
XLogRecPtr log_newpage_buffer(Buffer buffer, bool page_std)
Buffer XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber forknum, BlockNumber blkno, ReadBufferMode mode, Buffer recent_buffer)