mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Remove configure probe for fdatasync.
fdatasync() is in SUSv2, and all targeted Unix systems have it. We have a replacement function for Windows. We retain the probe for the function declaration, which allows us to supply the mysteriously missing declaration for macOS, and also for Windows. No need to keep a HAVE_FDATASYNC macro around. Also rename src/port/fdatasync.c to win32fdatasync.c since it's only for Windows. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com Discussion: https://postgr.es/m/CA%2BhUKGJZJVO%3DiX%2Beb-PXi2_XS9ZRqnn_4URh0NUQOwt6-_51xQ%40mail.gmail.com
This commit is contained in:
@@ -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 */
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user