From 1120c61b29c2804f921b4302769e73924c0e2893 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Thu, 23 Nov 2006 17:20:47 +0000
Subject: [PATCH] Revert out:

Update fsync test to match new O_DIRECT behavior.

Greg Smith
---
 src/tools/fsync/test_fsync.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/src/tools/fsync/test_fsync.c b/src/tools/fsync/test_fsync.c
index c313021155e..32d3aff003b 100644
--- a/src/tools/fsync/test_fsync.c
+++ b/src/tools/fsync/test_fsync.c
@@ -14,7 +14,6 @@
 #include <time.h>
 #include <sys/time.h>
 #include <unistd.h>
-#include <string.h>
 
 #ifdef WIN32
 #define FSYNC_FILENAME	"./test_fsync.out"
@@ -22,34 +21,21 @@
 #define FSYNC_FILENAME	"/var/tmp/test_fsync.out"
 #endif
 
-/* This logic comes from src/backend/access/transam/xlog.c where it's
-   better documented */
-#ifdef O_DIRECT
-#define PG_O_DIRECT                             O_DIRECT
-#else
-#define PG_O_DIRECT                             0
-#endif
-
+/* O_SYNC and O_FSYNC are the same */
 #if defined(O_SYNC)
-#define BARE_OPEN_SYNC_FLAG             O_SYNC
+#define OPEN_SYNC_FLAG		O_SYNC
 #elif defined(O_FSYNC)
-#define BARE_OPEN_SYNC_FLAG             O_FSYNC
-#endif
-#ifdef BARE_OPEN_SYNC_FLAG
-#define OPEN_SYNC_FLAG                  (BARE_OPEN_SYNC_FLAG | PG_O_DIRECT)
+#define OPEN_SYNC_FLAG		O_FSYNC
+#elif defined(O_DSYNC)
+#define OPEN_DATASYNC_FLAG	O_DSYNC
 #endif
 
-#if defined(O_DSYNC)
 #if defined(OPEN_SYNC_FLAG)
-#if O_DSYNC != BARE_OPEN_SYNC_FLAG
-#define OPEN_DATASYNC_FLAG              (O_DSYNC | PG_O_DIRECT)
-#endif
-#else
-#define OPEN_DATASYNC_FLAG              (O_DSYNC | PG_O_DIRECT)
+#if defined(O_DSYNC) && (O_DSYNC != OPEN_SYNC_FLAG)
+#define OPEN_DATASYNC_FLAG	O_DSYNC
 #endif
 #endif
 
-
 #define WAL_FILE_SIZE	(16 * 1024 * 1024)
 
 void		die(char *str);
-- 
GitLab