Re: bufmgr: pass through I/O stats context in FlushUnlockedBuffer() - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: bufmgr: pass through I/O stats context in FlushUnlockedBuffer()
Date
Msg-id CAAKRu_aUfeVKFW34ZvuhY9tBXUKYfn8rs-8cf-aE4YSUFj-xEQ@mail.gmail.com
Whole thread
In response to bufmgr: pass through I/O stats context in FlushUnlockedBuffer()  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: bufmgr: pass through I/O stats context in FlushUnlockedBuffer()
List pgsql-hackers
On Tue, Mar 31, 2026 at 10:15 PM Chao Li <li.evan.chao@gmail.com> wrote:
>
> I noticed that FlushUnlockedBuffer() accepts io_object and io_context, but then ignores them and hardcodes
IOOBJECT_RELATIONandIOCONTEXT_NORMAL instead: 
> ```
> static void
> FlushUnlockedBuffer(BufferDesc *buf, SMgrRelation reln,
>                                         IOObject io_object, IOContext io_context)
> {
>         Buffer          buffer = BufferDescriptorGetBuffer(buf);
>
>         BufferLockAcquire(buffer, buf, BUFFER_LOCK_SHARE_EXCLUSIVE);
>         FlushBuffer(buf, reln, IOOBJECT_RELATION, IOCONTEXT_NORMAL); // <== HERE
>         BufferLockUnlock(buffer, buf);
> }
> ```
>
> Unless I am missing something, if a function accepts these parameters, they should generally be used.

Thanks for the patch. Committed in 31b0544b32b

- Melanie



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)
Next
From: Chao Li
Date:
Subject: Re: bufmgr: pass through I/O stats context in FlushUnlockedBuffer()