From: Melanie Plageman Date: Tue, 21 Apr 2026 21:47:22 +0000 (-0400) Subject: bufmgr: use I/O stats arguments in FlushUnlockedBuffer() X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=31b0544b32bc9e08c8c6775aed7ca2b808390f80;p=thirdparty%2Fpostgresql.git bufmgr: use I/O stats arguments in FlushUnlockedBuffer() FlushUnlockedBuffer() accepted io_object and io_context arguments but hardcoded IOOBJECT_RELATION and IOCONTEXT_NORMAL when calling FlushBuffer(). Pass them through instead. Also fix FlushBuffer() to use its io_object parameter for I/O timing stats rather than hardcoding IOOBJECT_RELATION. Not actively broken since all current callers pass IOOBJECT_RELATION and IOCONTEXT_NORMAL, so not backpatched. Author: Chao Li Reviewed-by: Melanie Plageman Discussion: https://postgr.es/m/BC97546F-5C15-42F2-AD57-CFACDB9657D0@gmail.com --- diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 32f501bbd21..1fee559b7c6 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -4598,7 +4598,7 @@ FlushBuffer(BufferDesc *buf, SMgrRelation reln, IOObject io_object, * When a strategy is not in use, the write can only be a "regular" write * of a dirty shared buffer (IOCONTEXT_NORMAL IOOP_WRITE). */ - pgstat_count_io_op_time(IOOBJECT_RELATION, io_context, + pgstat_count_io_op_time(io_object, io_context, IOOP_WRITE, io_start, 1, BLCKSZ); pgBufferUsage.shared_blks_written++; @@ -4629,7 +4629,7 @@ FlushUnlockedBuffer(BufferDesc *buf, SMgrRelation reln, Buffer buffer = BufferDescriptorGetBuffer(buf); BufferLockAcquire(buffer, buf, BUFFER_LOCK_SHARE_EXCLUSIVE); - FlushBuffer(buf, reln, IOOBJECT_RELATION, IOCONTEXT_NORMAL); + FlushBuffer(buf, reln, io_object, io_context); BufferLockUnlock(buffer, buf); }