PostgreSQL Source Code: src/backend/storage/freespace/fsmpage.c File Reference (original) (raw)

Go to the source code of this file.
| Macros | |
|---|---|
| #define | leftchild(x) (2 * (x) + 1) |
| #define | rightchild(x) (2 * (x) + 2) |
| #define | parentof(x) (((x) - 1) / 2) |
| Functions | |
|---|---|
| static int | rightneighbor (int x) |
| bool | fsm_set_avail (Page page, int slot, uint8 value) |
| uint8 | fsm_get_avail (Page page, int slot) |
| uint8 | fsm_get_max_avail (Page page) |
| int | fsm_search_avail (Buffer buf, uint8 minvalue, bool advancenext, bool exclusive_lock_held) |
| bool | fsm_truncate_avail (Page page, int nslots) |
| bool | fsm_rebuild_page (Page page) |
◆ leftchild
◆ parentof
◆ rightchild
◆ fsm_get_avail()
◆ fsm_get_max_avail()
◆ fsm_rebuild_page()
◆ fsm_search_avail()
Definition at line 158 of file fsmpage.c.
160{
164 int target;
166
167restart:
168
169
170
171
172
174 return -1;
175
176
177
178
179
180
183 target = 0;
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
229 {
231 break;
232
233
234
235
236
238 }
239
240
241
242
243
244
246 {
248
251 {
253 continue;
254 }
255 childnodeno++;
258 {
260 }
261 else
262 {
263
264
265
266
267
268
269
270
274
276 elog(DEBUG1, "fixing corrupt FSM block %u, relation %u/%u/%u",
278
279
281 {
285 }
288 goto restart;
289 }
290 }
291
292
294
295
296
297
298
299
300
301
302
304
305 return slot;
306}
void BufferGetTag(Buffer buffer, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum)
void MarkBufferDirtyHint(Buffer buffer, bool buffer_std)
static Page BufferGetPage(Buffer buffer)
static void LockBuffer(Buffer buffer, BufferLockMode mode)
static int rightneighbor(int x)
bool fsm_rebuild_page(Page page)
static char buf[DEFAULT_XLOG_SEG_SIZE]
References buf, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetPage(), BufferGetTag(), RelFileLocator::dbOid, DEBUG1, elog, fb(), FSMPageData::fp_next_slot, fsm_rebuild_page(), LeafNodesPerPage, leftchild, LockBuffer(), MarkBufferDirtyHint(), NodesPerPage, NonLeafNodesPerPage, PageGetContents(), parentof, RelFileLocator::relNumber, rightneighbor(), and RelFileLocator::spcOid.
Referenced by fsm_search(), and fsm_set_and_search().
◆ fsm_set_avail()
Definition at line 63 of file fsmpage.c.
64{
68
70
72
73
75 return false;
76
78
79
80
81
82
83 do
84 {
88
92
97
100 break;
101
103 } while (nodeno > 0);
104
105
106
107
108
111
112 return true;
113}
References Assert, fb(), fsm_rebuild_page(), LeafNodesPerPage, leftchild, Max, NodesPerPage, NonLeafNodesPerPage, PageGetContents(), parentof, and value.
Referenced by fsm_search(), fsm_set_and_search(), fsm_vacuum_page(), and XLogRecordPageWithFreeSpace().