diff options
author | Michael Paquier <michael@paquier.xyz> | 2023-03-06 13:21:33 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2023-03-06 13:21:33 +0900 |
commit | ce340e530d1f76367379a8d230ad5f411e5f25d2 (patch) | |
tree | 6a17abed06cbd66092ea530a4b2894fc8148a185 /src/include/common/file_utils.h | |
parent | 47c0accbe05b5774a8a30e42e56e8d6026c9a858 (diff) | |
download | postgresql-ce340e530d1f76367379a8d230ad5f411e5f25d2.tar.gz postgresql-ce340e530d1f76367379a8d230ad5f411e5f25d2.zip |
Revise pg_pwrite_zeros()
The following changes are made to pg_write_zeros(), the API able to
write series of zeros using vectored I/O:
- Add of an "offset" parameter, to write the size from this position
(the 'p' of "pwrite" seems to mean position, though POSIX does not
outline ythat directly), hence the name of the routine is incorrect if
it is not able to handle offsets.
- Avoid memset() of "zbuffer" on every call.
- Avoid initialization of the whole IOV array if not needed.
- Group the trailing write() call with the main write() call,
simplifying the function logic.
Author: Andres Freund
Reviewed-by: Michael Paquier, Bharath Rupireddy
Discussion: https://postgr.es/m/20230215005525.mrrlmqrxzjzhaipl@awork3.anarazel.de
Diffstat (limited to 'src/include/common/file_utils.h')
-rw-r--r-- | src/include/common/file_utils.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/common/file_utils.h b/src/include/common/file_utils.h index bda6d3a5413..b7efa1226d6 100644 --- a/src/include/common/file_utils.h +++ b/src/include/common/file_utils.h @@ -44,6 +44,6 @@ extern ssize_t pg_pwritev_with_retry(int fd, int iovcnt, off_t offset); -extern ssize_t pg_pwrite_zeros(int fd, size_t size); +extern ssize_t pg_pwrite_zeros(int fd, size_t size, off_t offset); #endif /* FILE_UTILS_H */ |