@@ -137,7 +137,7 @@ static void vm_extend(Relation rel, BlockNumber vm_nblocks);
137
137
* any I/O. Returns true if any bits have been cleared and false otherwise.
138
138
*/
139
139
bool
140
- visibilitymap_clear (Relation rel , BlockNumber heapBlk , Buffer buf , uint8 flags )
140
+ visibilitymap_clear (Relation rel , BlockNumber heapBlk , Buffer vmbuf , uint8 flags )
141
141
{
142
142
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK (heapBlk );
143
143
int mapByte = HEAPBLK_TO_MAPBYTE (heapBlk );
@@ -152,21 +152,21 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf, uint8 flags)
152
152
elog (DEBUG1 , "vm_clear %s %d" , RelationGetRelationName (rel ), heapBlk );
153
153
#endif
154
154
155
- if (!BufferIsValid (buf ) || BufferGetBlockNumber (buf ) != mapBlock )
155
+ if (!BufferIsValid (vmbuf ) || BufferGetBlockNumber (vmbuf ) != mapBlock )
156
156
elog (ERROR , "wrong buffer passed to visibilitymap_clear" );
157
157
158
- LockBuffer (buf , BUFFER_LOCK_EXCLUSIVE );
159
- map = PageGetContents (BufferGetPage (buf ));
158
+ LockBuffer (vmbuf , BUFFER_LOCK_EXCLUSIVE );
159
+ map = PageGetContents (BufferGetPage (vmbuf ));
160
160
161
161
if (map [mapByte ] & mask )
162
162
{
163
163
map [mapByte ] &= ~mask ;
164
164
165
- MarkBufferDirty (buf );
165
+ MarkBufferDirty (vmbuf );
166
166
cleared = true;
167
167
}
168
168
169
- LockBuffer (buf , BUFFER_LOCK_UNLOCK );
169
+ LockBuffer (vmbuf , BUFFER_LOCK_UNLOCK );
170
170
171
171
return cleared ;
172
172
}
@@ -180,43 +180,43 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf, uint8 flags)
180
180
* shouldn't hold a lock on the heap page while doing that. Then, call
181
181
* visibilitymap_set to actually set the bit.
182
182
*
183
- * On entry, *buf should be InvalidBuffer or a valid buffer returned by
183
+ * On entry, *vmbuf should be InvalidBuffer or a valid buffer returned by
184
184
* an earlier call to visibilitymap_pin or visibilitymap_get_status on the same
185
- * relation. On return, *buf is a valid buffer with the map page containing
185
+ * relation. On return, *vmbuf is a valid buffer with the map page containing
186
186
* the bit for heapBlk.
187
187
*
188
188
* If the page doesn't exist in the map file yet, it is extended.
189
189
*/
190
190
void
191
- visibilitymap_pin (Relation rel , BlockNumber heapBlk , Buffer * buf )
191
+ visibilitymap_pin (Relation rel , BlockNumber heapBlk , Buffer * vmbuf )
192
192
{
193
193
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK (heapBlk );
194
194
195
195
/* Reuse the old pinned buffer if possible */
196
- if (BufferIsValid (* buf ))
196
+ if (BufferIsValid (* vmbuf ))
197
197
{
198
- if (BufferGetBlockNumber (* buf ) == mapBlock )
198
+ if (BufferGetBlockNumber (* vmbuf ) == mapBlock )
199
199
return ;
200
200
201
- ReleaseBuffer (* buf );
201
+ ReleaseBuffer (* vmbuf );
202
202
}
203
- * buf = vm_readbuf (rel , mapBlock , true);
203
+ * vmbuf = vm_readbuf (rel , mapBlock , true);
204
204
}
205
205
206
206
/*
207
207
* visibilitymap_pin_ok - do we already have the correct page pinned?
208
208
*
209
- * On entry, buf should be InvalidBuffer or a valid buffer returned by
209
+ * On entry, vmbuf should be InvalidBuffer or a valid buffer returned by
210
210
* an earlier call to visibilitymap_pin or visibilitymap_get_status on the same
211
211
* relation. The return value indicates whether the buffer covers the
212
212
* given heapBlk.
213
213
*/
214
214
bool
215
- visibilitymap_pin_ok (BlockNumber heapBlk , Buffer buf )
215
+ visibilitymap_pin_ok (BlockNumber heapBlk , Buffer vmbuf )
216
216
{
217
217
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK (heapBlk );
218
218
219
- return BufferIsValid (buf ) && BufferGetBlockNumber (buf ) == mapBlock ;
219
+ return BufferIsValid (vmbuf ) && BufferGetBlockNumber (vmbuf ) == mapBlock ;
220
220
}
221
221
222
222
/*
@@ -314,11 +314,11 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
314
314
* Are all tuples on heapBlk visible to all or are marked frozen, according
315
315
* to the visibility map?
316
316
*
317
- * On entry, *buf should be InvalidBuffer or a valid buffer returned by an
317
+ * On entry, *vmbuf should be InvalidBuffer or a valid buffer returned by an
318
318
* earlier call to visibilitymap_pin or visibilitymap_get_status on the same
319
- * relation. On return, *buf is a valid buffer with the map page containing
319
+ * relation. On return, *vmbuf is a valid buffer with the map page containing
320
320
* the bit for heapBlk, or InvalidBuffer. The caller is responsible for
321
- * releasing *buf after it's done testing and setting bits.
321
+ * releasing *vmbuf after it's done testing and setting bits.
322
322
*
323
323
* NOTE: This function is typically called without a lock on the heap page,
324
324
* so somebody else could change the bit just after we look at it. In fact,
@@ -328,7 +328,7 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
328
328
* all concurrency issues!
329
329
*/
330
330
uint8
331
- visibilitymap_get_status (Relation rel , BlockNumber heapBlk , Buffer * buf )
331
+ visibilitymap_get_status (Relation rel , BlockNumber heapBlk , Buffer * vmbuf )
332
332
{
333
333
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK (heapBlk );
334
334
uint32 mapByte = HEAPBLK_TO_MAPBYTE (heapBlk );
@@ -341,23 +341,23 @@ visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *buf)
341
341
#endif
342
342
343
343
/* Reuse the old pinned buffer if possible */
344
- if (BufferIsValid (* buf ))
344
+ if (BufferIsValid (* vmbuf ))
345
345
{
346
- if (BufferGetBlockNumber (* buf ) != mapBlock )
346
+ if (BufferGetBlockNumber (* vmbuf ) != mapBlock )
347
347
{
348
- ReleaseBuffer (* buf );
349
- * buf = InvalidBuffer ;
348
+ ReleaseBuffer (* vmbuf );
349
+ * vmbuf = InvalidBuffer ;
350
350
}
351
351
}
352
352
353
- if (!BufferIsValid (* buf ))
353
+ if (!BufferIsValid (* vmbuf ))
354
354
{
355
- * buf = vm_readbuf (rel , mapBlock , false);
356
- if (!BufferIsValid (* buf ))
355
+ * vmbuf = vm_readbuf (rel , mapBlock , false);
356
+ if (!BufferIsValid (* vmbuf ))
357
357
return false;
358
358
}
359
359
360
- map = PageGetContents (BufferGetPage (* buf ));
360
+ map = PageGetContents (BufferGetPage (* vmbuf ));
361
361
362
362
/*
363
363
* A single byte read is atomic. There could be memory-ordering effects
0 commit comments