]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Provide vectored variants of FileRead() and FileWrite().
authorThomas Munro <tmunro@postgresql.org>
Mon, 11 Dec 2023 22:56:11 +0000 (11:56 +1300)
committerThomas Munro <tmunro@postgresql.org>
Tue, 12 Dec 2023 00:12:43 +0000 (13:12 +1300)
commit871fe4917e1e92304bdcc2ab779de7416492c6de
tree3a914d81d73f25cdc1b5058996fda6a01f8c4ce0
parent0c6be59f5e34f44b20d9ec3ffb58c1d9a0bf985e
Provide vectored variants of FileRead() and FileWrite().

FileReadV() and FileWriteV() adapt pg_preadv() and pg_pwritev() for
fd.c's virtual file descriptors.  The simple FileRead() and FileWrite()
functions are now implemented in terms of the vectored functions, to
avoid code duplication, and they are converted back to the corresponding
simple system calls further down (commit 15c9ac36).  Later work will
make more interesting multi-iovec calls.

The traditional behavior of reporting a "fake" ENOSPC error is
simplified.  It's now always set for non-failing writes, for the benefit
of callers that expect to log a meaningful "%m" if they determine that
the write was short.  (Perhaps we should consider getting rid of that
expectation one day.)

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com
src/backend/storage/file/fd.c
src/include/storage/fd.h