]> git.ipfire.org Git - thirdparty/postgresql.git/commit
bufmgr: Pass io_object and io_context through to PinBufferForBlock()
authorAndres Freund <andres@anarazel.de>
Thu, 26 Mar 2026 14:50:44 +0000 (10:50 -0400)
committerAndres Freund <andres@anarazel.de>
Thu, 26 Mar 2026 16:07:05 +0000 (12:07 -0400)
commitc2a68e08b13f3cb437c92102fb11ab0f45dbd67f
treec159e274f503ff819d6903ca26dcbdd35761028f
parent5dcb15e89af2d9fbc3b038c2ea420905b279fdaf
bufmgr: Pass io_object and io_context through to PinBufferForBlock()

PinBufferForBlock() is always_inline and called in a loop in
StartReadBuffersImpl(). Previously it computed io_context and io_object
internally, which required calling IOContextForStrategy() -- a non-inline
function the compiler cannot prove is side-effect-free. This could potential
cause unneeded redundant function calls.

Compute io_context and io_object in the callers instead, allowing
StartReadBuffersImpl() to do so once before entering the loop.

Author: Melanie Plageman <melanieplageman@gmail.com>
Suggested-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/zljergweqti7x67lg5ije2rzjusie37nslsnkjkkby4laqqbfw@3p3zu522yykv
src/backend/storage/buffer/bufmgr.c