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 <lic@highgo.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/BC97546F-5C15-42F2-AD57-CFACDB9657D0@gmail.com
This commit is contained in:
Melanie Plageman 2026-04-21 17:47:22 -04:00
parent 62407d26b7
commit 31b0544b32

View file

@ -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);
}