From 0c6be59f5e34f44b20d9ec3ffb58c1d9a0bf985e Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Tue, 12 Dec 2023 10:28:46 +1300 Subject: Provide helper for retrying partial vectored I/O. compute_remaining_iovec() is a re-usable routine for retrying after pg_readv() or pg_writev() reports a short transfer. This will gain new users in a later commit, but can already replace the open-coded equivalent code in the existing pg_pwritev_with_retry() function. Reviewed-by: Heikki Linnakangas Discussion: https://postgr.es/m/CA+hUKGJkOiOCa+mag4BF+zHo7qo=o9CFheB8=g6uT5TUm2gkvA@mail.gmail.com --- src/include/common/file_utils.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/include/common/file_utils.h') diff --git a/src/include/common/file_utils.h b/src/include/common/file_utils.h index 3bb20170cbd..02a940e3102 100644 --- a/src/include/common/file_utils.h +++ b/src/include/common/file_utils.h @@ -46,6 +46,11 @@ extern PGFileType get_dirent_type(const char *path, bool look_through_symlinks, int elevel); +extern int compute_remaining_iovec(struct iovec *destination, + const struct iovec *source, + int iovcnt, + size_t transferred); + extern ssize_t pg_pwritev_with_retry(int fd, const struct iovec *iov, int iovcnt, -- cgit v1.2.3