aio: Implement support for reads in smgr/md/fd
authorAndres Freund <andres@anarazel.de>
Sat, 29 Mar 2025 17:38:35 +0000 (13:38 -0400)
committerAndres Freund <andres@anarazel.de>
Sat, 29 Mar 2025 17:38:35 +0000 (13:38 -0400)
commit50cb7505b3010736b9a7922e903931534785f3aa
treefc507553c57dc1761ab44864146434b5713592ab
parentdee80024688c32fc259a3cff040b609b837a35ec
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@leadboat.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
src/backend/storage/aio/aio_callback.c
src/backend/storage/aio/aio_target.c
src/backend/storage/file/fd.c
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/include/storage/aio.h
src/include/storage/aio_types.h
src/include/storage/fd.h
src/include/storage/md.h
src/include/storage/smgr.h