Use UnlockReleaseBuffer() in more places

An upcoming commit will make UnlockReleaseBuffer() considerably faster and
more scalable than doing LockBuffer(BUFFER_LOCK_UNLOCK); ReleaseBuffer();. But
it's a small performance benefit even as-is.

Most of the callsites changed in this patch are not performance sensitive,
however some, like the nbtree ones, are in critical paths.

This patch changes all the easily convertible places over to
UnlockReleaseBuffer() mainly because I needed to check all of them anyway, and
reducing cases where the operations are done separately makes the checking
easier.

Reviewed-by: Melanie Plageman <[email protected]>
Discussion: 
https://postgr.es/m/5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8df3c48e466cfe8a1f9ccd3fb367244d4a47e94a

Modified Files
--------------
contrib/amcheck/verify_gin.c              |  6 ++----
contrib/pageinspect/rawpage.c             |  3 +--
src/backend/access/heap/heapam.c          |  6 ++----
src/backend/access/heap/hio.c             |  7 ++++---
src/backend/access/nbtree/nbtpage.c       | 35 +++++++++++++++++++++++++------
src/backend/storage/buffer/bufmgr.c       |  3 +--
src/backend/storage/freespace/freespace.c |  3 +--
src/test/modules/test_aio/test_aio.c      |  7 ++-----
8 files changed, 42 insertions(+), 28 deletions(-)

Reply via email to