aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap/visibilitymap.c
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2022-09-19 16:46:23 -0700
committerPeter Geoghegan <pg@bowt.ie>2022-09-19 16:46:23 -0700
commit4bac9600f09a9b9ba7daa3ba69495a877f51e6c3 (patch)
tree393793229287ddc1973e73865a1f634415723971 /src/backend/access/heap/visibilitymap.c
parentcb8ff7ed5ac907a4a574413f3e46a3522d7b164c (diff)
downloadpostgresql-4bac9600f09a9b9ba7daa3ba69495a877f51e6c3.tar.gz
postgresql-4bac9600f09a9b9ba7daa3ba69495a877f51e6c3.zip
Harmonize heapam and tableam parameter names.
Make sure that function declarations use names that exactly match the corresponding names from function definitions. Having parameter names that are reliably consistent in this way will make it easier to reason about groups of related C functions from the same translation unit as a module. It will also make certain refactoring tasks easier. Like other recent commits that cleaned up function parameter names, this commit was written with help from clang-tidy. Later commits will do the same for other parts of the codebase. Author: Peter Geoghegan <pg@bowt.ie> Reviewed-By: David Rowley <dgrowleyml@gmail.com> Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com
Diffstat (limited to 'src/backend/access/heap/visibilitymap.c')
-rw-r--r--src/backend/access/heap/visibilitymap.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index ed72eb7b631..d62761728b0 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -137,7 +137,7 @@ static void vm_extend(Relation rel, BlockNumber vm_nblocks);
* any I/O. Returns true if any bits have been cleared and false otherwise.
*/
bool
-visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf, uint8 flags)
+visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer vmbuf, uint8 flags)
{
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK(heapBlk);
int mapByte = HEAPBLK_TO_MAPBYTE(heapBlk);
@@ -152,21 +152,21 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf, uint8 flags)
elog(DEBUG1, "vm_clear %s %d", RelationGetRelationName(rel), heapBlk);
#endif
- if (!BufferIsValid(buf) || BufferGetBlockNumber(buf) != mapBlock)
+ if (!BufferIsValid(vmbuf) || BufferGetBlockNumber(vmbuf) != mapBlock)
elog(ERROR, "wrong buffer passed to visibilitymap_clear");
- LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
- map = PageGetContents(BufferGetPage(buf));
+ LockBuffer(vmbuf, BUFFER_LOCK_EXCLUSIVE);
+ map = PageGetContents(BufferGetPage(vmbuf));
if (map[mapByte] & mask)
{
map[mapByte] &= ~mask;
- MarkBufferDirty(buf);
+ MarkBufferDirty(vmbuf);
cleared = true;
}
- LockBuffer(buf, BUFFER_LOCK_UNLOCK);
+ LockBuffer(vmbuf, BUFFER_LOCK_UNLOCK);
return cleared;
}
@@ -180,43 +180,43 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk, Buffer buf, uint8 flags)
* shouldn't hold a lock on the heap page while doing that. Then, call
* visibilitymap_set to actually set the bit.
*
- * On entry, *buf should be InvalidBuffer or a valid buffer returned by
+ * On entry, *vmbuf should be InvalidBuffer or a valid buffer returned by
* an earlier call to visibilitymap_pin or visibilitymap_get_status on the same
- * relation. On return, *buf is a valid buffer with the map page containing
+ * relation. On return, *vmbuf is a valid buffer with the map page containing
* the bit for heapBlk.
*
* If the page doesn't exist in the map file yet, it is extended.
*/
void
-visibilitymap_pin(Relation rel, BlockNumber heapBlk, Buffer *buf)
+visibilitymap_pin(Relation rel, BlockNumber heapBlk, Buffer *vmbuf)
{
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK(heapBlk);
/* Reuse the old pinned buffer if possible */
- if (BufferIsValid(*buf))
+ if (BufferIsValid(*vmbuf))
{
- if (BufferGetBlockNumber(*buf) == mapBlock)
+ if (BufferGetBlockNumber(*vmbuf) == mapBlock)
return;
- ReleaseBuffer(*buf);
+ ReleaseBuffer(*vmbuf);
}
- *buf = vm_readbuf(rel, mapBlock, true);
+ *vmbuf = vm_readbuf(rel, mapBlock, true);
}
/*
* visibilitymap_pin_ok - do we already have the correct page pinned?
*
- * On entry, buf should be InvalidBuffer or a valid buffer returned by
+ * On entry, vmbuf should be InvalidBuffer or a valid buffer returned by
* an earlier call to visibilitymap_pin or visibilitymap_get_status on the same
* relation. The return value indicates whether the buffer covers the
* given heapBlk.
*/
bool
-visibilitymap_pin_ok(BlockNumber heapBlk, Buffer buf)
+visibilitymap_pin_ok(BlockNumber heapBlk, Buffer vmbuf)
{
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK(heapBlk);
- return BufferIsValid(buf) && BufferGetBlockNumber(buf) == mapBlock;
+ return BufferIsValid(vmbuf) && BufferGetBlockNumber(vmbuf) == mapBlock;
}
/*
@@ -314,11 +314,11 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
* Are all tuples on heapBlk visible to all or are marked frozen, according
* to the visibility map?
*
- * On entry, *buf should be InvalidBuffer or a valid buffer returned by an
+ * On entry, *vmbuf should be InvalidBuffer or a valid buffer returned by an
* earlier call to visibilitymap_pin or visibilitymap_get_status on the same
- * relation. On return, *buf is a valid buffer with the map page containing
+ * relation. On return, *vmbuf is a valid buffer with the map page containing
* the bit for heapBlk, or InvalidBuffer. The caller is responsible for
- * releasing *buf after it's done testing and setting bits.
+ * releasing *vmbuf after it's done testing and setting bits.
*
* NOTE: This function is typically called without a lock on the heap page,
* 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,
* all concurrency issues!
*/
uint8
-visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *buf)
+visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *vmbuf)
{
BlockNumber mapBlock = HEAPBLK_TO_MAPBLOCK(heapBlk);
uint32 mapByte = HEAPBLK_TO_MAPBYTE(heapBlk);
@@ -341,23 +341,23 @@ visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *buf)
#endif
/* Reuse the old pinned buffer if possible */
- if (BufferIsValid(*buf))
+ if (BufferIsValid(*vmbuf))
{
- if (BufferGetBlockNumber(*buf) != mapBlock)
+ if (BufferGetBlockNumber(*vmbuf) != mapBlock)
{
- ReleaseBuffer(*buf);
- *buf = InvalidBuffer;
+ ReleaseBuffer(*vmbuf);
+ *vmbuf = InvalidBuffer;
}
}
- if (!BufferIsValid(*buf))
+ if (!BufferIsValid(*vmbuf))
{
- *buf = vm_readbuf(rel, mapBlock, false);
- if (!BufferIsValid(*buf))
+ *vmbuf = vm_readbuf(rel, mapBlock, false);
+ if (!BufferIsValid(*vmbuf))
return false;
}
- map = PageGetContents(BufferGetPage(*buf));
+ map = PageGetContents(BufferGetPage(*vmbuf));
/*
* A single byte read is atomic. There could be memory-ordering effects