aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/storage/file/fd.c9
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample2
2 files changed, 6 insertions, 5 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);
}
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 80ee04d30a9..f436b834680 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -157,7 +157,7 @@
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
# open_datasync
- # fdatasync
+ # fdatasync (default on Linux)
# fsync
# fsync_writethrough
# open_sync