diff options
author | Andres Freund <andres@anarazel.de> | 2025-10-08 16:06:19 -0400 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2025-10-08 16:06:19 -0400 |
commit | 3baae90013df58a8d124afa79df07075b8ebea09 (patch) | |
tree | c7475043465b3e314bac0e1bef04c9d8d8e0e524 /src/include/storage/bufmgr.h | |
parent | 2a2e1b470b9b4e9c7d76bc227db02a2efbb57473 (diff) |
bufmgr: fewer calls to BufferDescriptorGetContentLock
We're planning to merge buffer content locks into BufferDesc.state. To reduce
the size of that patch, centralize calls to BufferDescriptorGetContentLock().
The biggest part of the change is in assertions, by introducing
BufferIsLockedByMe[InMode]() (and removing BufferIsExclusiveLocked()). This
seems like an improvement even without aforementioned plans.
Additionally replace some direct calls to LWLockAcquire() with calls to
LockBuffer().
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff
Diffstat (limited to 'src/include/storage/bufmgr.h')
-rw-r--r-- | src/include/storage/bufmgr.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 47360a3d3d8..3f37b294af6 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -230,7 +230,8 @@ extern void WaitReadBuffers(ReadBuffersOperation *operation); extern void ReleaseBuffer(Buffer buffer); extern void UnlockReleaseBuffer(Buffer buffer); -extern bool BufferIsExclusiveLocked(Buffer buffer); +extern bool BufferIsLockedByMe(Buffer buffer); +extern bool BufferIsLockedByMeInMode(Buffer buffer, int mode); extern bool BufferIsDirty(Buffer buffer); extern void MarkBufferDirty(Buffer buffer); extern void IncrBufferRefCount(Buffer buffer); |