aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/file/fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/file/fd.c')
-rw-r--r--src/backend/storage/file/fd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index fd5ec7805fd..4f7dc39d638 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -260,12 +260,13 @@ static bool looks_like_temp_rel_name(const char *name);
int
pg_fsync(int fd)
{
-#ifndef HAVE_FSYNC_WRITETHROUGH_ONLY
- if (sync_method != SYNC_METHOD_FSYNC_WRITETHROUGH)
- return pg_fsync_no_writethrough(fd);
+ /* #if is to skip the sync_method test if there's no need for it */
+#if defined(HAVE_FSYNC_WRITETHROUGH) && !defined(FSYNC_WRITETHROUGH_IS_FSYNC)
+ if (sync_method == SYNC_METHOD_FSYNC_WRITETHROUGH)
+ return pg_fsync_writethrough(fd);
else
#endif
- return pg_fsync_writethrough(fd);
+ return pg_fsync_no_writethrough(fd);
}