29 #define leftchild(x) (2 * (x) + 1)
30 #define rightchild(x) (2 * (x) + 2)
31 #define parentof(x) (((x) - 1) / 2)
51 if (((
x + 1) &
x) == 0)
71 oldvalue = fsmpage->
fp_nodes[nodeno];
74 if (oldvalue ==
value && value <= fsmpage->fp_nodes[0])
93 newvalue = fsmpage->
fp_nodes[lchild];
95 newvalue =
Max(newvalue,
98 oldvalue = fsmpage->
fp_nodes[nodeno];
99 if (oldvalue == newvalue)
102 fsmpage->
fp_nodes[nodeno] = newvalue;
103 }
while (nodeno > 0);
159 bool exclusive_lock_held)
173 if (fsmpage->
fp_nodes[0] < minvalue)
230 if (fsmpage->
fp_nodes[nodeno] >= minvalue)
250 fsmpage->
fp_nodes[childnodeno] >= minvalue)
252 nodeno = childnodeno;
257 fsmpage->
fp_nodes[childnodeno] >= minvalue)
259 nodeno = childnodeno;
276 elog(
DEBUG1,
"fixing corrupt FSM block %u, relation %u/%u/%u",
280 if (!exclusive_lock_held)
284 exclusive_lock_held =
true;
317 bool changed =
false;
345 bool changed =
false;
355 int rchild = lchild + 1;
360 newvalue = fsmpage->
fp_nodes[lchild];
363 newvalue =
Max(newvalue,
366 if (fsmpage->
fp_nodes[nodeno] != newvalue)
368 fsmpage->
fp_nodes[nodeno] = newvalue;
void BufferGetTag(Buffer buffer, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum)
void LockBuffer(Buffer buffer, int mode)
void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
#define BUFFER_LOCK_UNLOCK
static Page BufferGetPage(Buffer buffer)
#define BUFFER_LOCK_EXCLUSIVE
static char * PageGetContents(Page page)
#define Assert(condition)
#define NonLeafNodesPerPage
static int rightneighbor(int x)
uint8 fsm_get_avail(Page page, int slot)
bool fsm_rebuild_page(Page page)
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)
uint8 fp_nodes[FLEXIBLE_ARRAY_MEMBER]