pgsql: Provide vectored variants of FileRead() and FileWrite().

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Provide vectored variants of FileRead() and FileWrite().
Date: 2023-12-12 00:15:55
Message-ID: E1rCqRH-009l2q-8U@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)iki(dot)fi>
Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/871fe4917e1e92304bdcc2ab779de7416492c6de

Modified Files
--------------
src/backend/storage/file/fd.c | 43 +++++++++++++++++++++++++------------------
src/include/storage/fd.h | 32 +++++++++++++++++++++++++++++---
2 files changed, 54 insertions(+), 21 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-12-12 11:24:34 pgsql: Fix typo in comment
Previous Message Thomas Munro 2023-12-11 22:08:40 pgsql: Provide helper for retrying partial vectored I/O.