pgsql: aio: Implement support for reads in smgr/md/fd

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: aio: Implement support for reads in smgr/md/fd
Date: 2025-03-29 18:08:45
Message-ID: E1tyabt-001coq-07@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

aio: Implement support for reads in smgr/md/fd

This implements the following:

1) An smgr AIO target, for AIO on smgr files. This should be usable not just
for md.c but also other SMGR implementation if we ever get them.
2) readv support in fd.c, which requires a small bit of infrastructure work in
fd.c
3) smgr.c and md.c support for readv

There still is nothing performing AIO, but as of this commit it would be
possible.

As part of this change FileGetRawDesc() actually ensures that the file is
opened - previously it was basically not usable. It's used to reopen a file in
IO workers.

Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Discussion: https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt
Discussion: https://postgr.es/m/20210223100344.llw5an2aklengrmn@alap3.anarazel.de
Discussion: https://postgr.es/m/stj36ea6yyhoxtqkhpieia2z4krnam7qyetc57rfezgk4zgapf@gcnactj4z56m

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/50cb7505b3010736b9a7922e903931534785f3aa

Modified Files
--------------
src/backend/storage/aio/aio_callback.c | 3 +
src/backend/storage/aio/aio_target.c | 2 +
src/backend/storage/file/fd.c | 40 +++++++
src/backend/storage/smgr/md.c | 196 +++++++++++++++++++++++++++++++++
src/backend/storage/smgr/smgr.c | 161 +++++++++++++++++++++++++++
src/include/storage/aio.h | 5 +-
src/include/storage/aio_types.h | 10 +-
src/include/storage/fd.h | 3 +
src/include/storage/md.h | 7 ++
src/include/storage/smgr.h | 14 +++
10 files changed, 437 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-03-29 18:57:00 pgsql: aio, bufmgr: Comment fixes/improvements
Previous Message Jeff Davis 2025-03-29 16:24:58 Re: pgsql: pg_upgrade: Fix inconsistency in memory freeing