diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/transam/xlog.c | 4 | ||||
-rw-r--r-- | src/backend/storage/file/fd.c | 8 | ||||
-rw-r--r-- | src/bin/pg_test_fsync/pg_test_fsync.c | 4 | ||||
-rw-r--r-- | src/include/access/xlogdefs.h | 7 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 3 | ||||
-rw-r--r-- | src/include/port/freebsd.h | 2 | ||||
-rw-r--r-- | src/include/port/win32_port.h | 8 | ||||
-rw-r--r-- | src/port/win32fdatasync.c (renamed from src/port/fdatasync.c) | 6 | ||||
-rw-r--r-- | src/tools/msvc/Mkvcbuild.pm | 3 | ||||
-rw-r--r-- | src/tools/msvc/Solution.pm | 1 |
10 files changed, 7 insertions, 39 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index eb5115fd5a8..34f0150d1ee 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -168,9 +168,7 @@ const struct config_enum_entry sync_method_options[] = { #ifdef HAVE_FSYNC_WRITETHROUGH {"fsync_writethrough", SYNC_METHOD_FSYNC_WRITETHROUGH, false}, #endif -#ifdef HAVE_FDATASYNC {"fdatasync", SYNC_METHOD_FDATASYNC, false}, -#endif #ifdef O_SYNC {"open_sync", SYNC_METHOD_OPEN, false}, #endif @@ -8015,12 +8013,10 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) msg = _("could not fsync write-through file \"%s\": %m"); break; #endif -#ifdef HAVE_FDATASYNC case SYNC_METHOD_FDATASYNC: if (pg_fdatasync(fd) != 0) msg = _("could not fdatasync file \"%s\": %m"); break; -#endif case SYNC_METHOD_OPEN: case SYNC_METHOD_OPEN_DSYNC: /* not reachable */ diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 5a2eb012381..ccb540d6178 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -442,20 +442,12 @@ pg_fsync_writethrough(int fd) /* * pg_fdatasync --- same as fdatasync except does nothing if enableFsync is off - * - * Not all platforms have fdatasync; treat as fsync if not available. */ int pg_fdatasync(int fd) { if (enableFsync) - { -#ifdef HAVE_FDATASYNC return fdatasync(fd); -#else - return fsync(fd); -#endif - } else return 0; } diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c index 8f0ef8e66b9..77f0db0376b 100644 --- a/src/bin/pg_test_fsync/pg_test_fsync.c +++ b/src/bin/pg_test_fsync/pg_test_fsync.c @@ -331,7 +331,6 @@ test_sync(int writes_per_op) printf(LABEL_FORMAT, "fdatasync"); fflush(stdout); -#ifdef HAVE_FDATASYNC if ((tmpfile = open(filename, O_RDWR | PG_BINARY, 0)) == -1) die("could not open output file"); START_TIMER; @@ -347,9 +346,6 @@ test_sync(int writes_per_op) } STOP_TIMER; close(tmpfile); -#else - printf(NA_FORMAT, _("n/a")); -#endif /* * Test fsync diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h index 810cd1fd86a..49e581925c9 100644 --- a/src/include/access/xlogdefs.h +++ b/src/include/access/xlogdefs.h @@ -67,8 +67,7 @@ typedef uint16 RepOriginId; /* * This chunk of hackery attempts to determine which file sync methods * are available on the current platform, and to choose an appropriate - * default method. We assume that fsync() is always available, and that - * configure determined whether fdatasync() is. + * default method. * * Note that we define our own O_DSYNC on Windows, but not O_SYNC. */ @@ -76,10 +75,8 @@ typedef uint16 RepOriginId; #define DEFAULT_SYNC_METHOD PLATFORM_DEFAULT_SYNC_METHOD #elif defined(O_DSYNC) && (!defined(O_SYNC) || O_DSYNC != O_SYNC) #define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN_DSYNC -#elif defined(HAVE_FDATASYNC) -#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC #else -#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC +#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC #endif #endif /* XLOG_DEFS_H */ diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 6505a842118..2a0d08d10f5 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -170,9 +170,6 @@ /* Define to 1 if you have the `explicit_bzero' function. */ #undef HAVE_EXPLICIT_BZERO -/* Define to 1 if you have the `fdatasync' function. */ -#undef HAVE_FDATASYNC - /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO diff --git a/src/include/port/freebsd.h b/src/include/port/freebsd.h index 2e2e749a6b6..0e3fde55d6d 100644 --- a/src/include/port/freebsd.h +++ b/src/include/port/freebsd.h @@ -5,6 +5,4 @@ * would prefer open_datasync on FreeBSD 13+, but that is not a good choice on * many systems. */ -#ifdef HAVE_FDATASYNC #define PLATFORM_DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC -#endif diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h index 336e11b3ba4..0eaa97561a0 100644 --- a/src/include/port/win32_port.h +++ b/src/include/port/win32_port.h @@ -83,14 +83,6 @@ #define HAVE_FSYNC_WRITETHROUGH #define FSYNC_WRITETHROUGH_IS_FSYNC -/* - * We have a replacement for fdatasync() in src/port/fdatasync.c, which is - * unconditionally used by MSVC and Mingw builds. - */ -#ifndef HAVE_FDATASYNC -#define HAVE_FDATASYNC -#endif - #define USES_WINSOCK /* diff --git a/src/port/fdatasync.c b/src/port/win32fdatasync.c index afef853aa3c..31d631c6962 100644 --- a/src/port/fdatasync.c +++ b/src/port/win32fdatasync.c @@ -1,12 +1,12 @@ /*------------------------------------------------------------------------- * - * fdatasync.c + * win32fdatasync.c * Win32 fdatasync() replacement * * - * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group * - * src/port/fdatasync.c + * src/port/win32fdatasync.c * *------------------------------------------------------------------------- */ diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm index a06dbcae4d2..8d88e78f051 100644 --- a/src/tools/msvc/Mkvcbuild.pm +++ b/src/tools/msvc/Mkvcbuild.pm @@ -99,7 +99,7 @@ sub mkvcbuild $solution = CreateSolution($vsVersion, $config); our @pgportfiles = qw( - chklocale.c explicit_bzero.c fdatasync.c + chklocale.c explicit_bzero.c getpeereid.c getrusage.c inet_aton.c getaddrinfo.c gettimeofday.c inet_net_ntop.c kill.c open.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c @@ -110,6 +110,7 @@ sub mkvcbuild strerror.c tar.c win32dlopen.c win32env.c win32error.c + win32fdatasync.c win32link.c win32pread.c win32pwrite.c diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index bd8b755b964..d7ab6ab2587 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -252,7 +252,6 @@ sub GenerateFiles HAVE_EDITLINE_READLINE_H => undef, HAVE_EXECINFO_H => undef, HAVE_EXPLICIT_BZERO => undef, - HAVE_FDATASYNC => 1, HAVE_FSEEKO => 1, HAVE_FUNCNAME__FUNC => undef, HAVE_FUNCNAME__FUNCTION => 1, |