163163test_sync (int writes_per_op )
164164{
165165int tmpfile ,ops ,writes ;
166-
166+ bool fs_warning = false;
167+
167168if (writes_per_op == 1 )
168169printf ("\nCompare file sync methods using one write:\n" );
169170else
@@ -176,9 +177,17 @@ test_sync(int writes_per_op)
176177 */
177178#ifdef OPEN_DATASYNC_FLAG
178179if (writes_per_op == 1 )
179- printf (LABEL_FORMAT ,"open_datasync 8k write" );
180+ printf (LABEL_FORMAT ,"open_datasync 8k write"
181+ #if PG_O_DIRECT != 0
182+ "**"
183+ #endif
184+ );
180185else
181- printf (LABEL_FORMAT ,"2 open_datasync 8k writes" );
186+ printf (LABEL_FORMAT ,"2 open_datasync 8k writes"
187+ #if PG_O_DIRECT != 0
188+ "**"
189+ #endif
190+ );
182191fflush (stdout );
183192
184193if ((tmpfile = open (filename ,O_RDWR |O_DSYNC ,0 ))== -1 )
@@ -201,7 +210,10 @@ test_sync(int writes_per_op)
201210 */
202211#if PG_O_DIRECT != 0
203212if ((tmpfile = open (filename ,O_RDWR |O_DSYNC |PG_O_DIRECT ,0 ))== -1 )
204- printf (NA_FORMAT ,"o_direct" ,"n/a on this filesystem\n" );
213+ {
214+ printf (NA_FORMAT ,"o_direct" ,"n/a*\n" );
215+ fs_warning = true;
216+ }
205217else
206218{
207219if (writes_per_op == 1 )
@@ -321,9 +333,17 @@ test_sync(int writes_per_op)
321333 */
322334#ifdef OPEN_SYNC_FLAG
323335if (writes_per_op == 1 )
324- printf (LABEL_FORMAT ,"open_sync 8k write" );
336+ printf (LABEL_FORMAT ,"open_sync 8k write"
337+ #if PG_O_DIRECT != 0
338+ "**"
339+ #endif
340+ );
325341else
326- printf (LABEL_FORMAT ,"2 open_sync 8k writes" );
342+ printf (LABEL_FORMAT ,"2 open_sync 8k writes"
343+ #if PG_O_DIRECT != 0
344+ "**"
345+ #endif
346+ );
327347fflush (stdout );
328348
329349if ((tmpfile = open (filename ,O_RDWR |OPEN_SYNC_FLAG ,0 ))== -1 )
@@ -352,7 +372,10 @@ test_sync(int writes_per_op)
352372fflush (stdout );
353373
354374if ((tmpfile = open (filename ,O_RDWR |OPEN_SYNC_FLAG |PG_O_DIRECT ,0 ))== -1 )
355- printf (NA_FORMAT ,"o_direct" ,"n/a on this filesystem\n" );
375+ {
376+ printf (NA_FORMAT ,"o_direct" ,"n/a*\n" );
377+ fs_warning = true;
378+ }
356379else
357380{
358381gettimeofday (& start_t ,NULL );
@@ -375,6 +398,17 @@ test_sync(int writes_per_op)
375398#else
376399printf (NA_FORMAT ,"open_sync" ,"n/a\n" );
377400#endif
401+
402+ if (fs_warning )
403+ {
404+ printf ("* This file system and its mount options do not support direct\n" );
405+ printf ("I/O, e.g. ext4 in journaled mode.\n" );
406+ }
407+
408+ #if defined(OPEN_DATASYNC_FLAG )|| defined(OPEN_SYNC_FLAG )
409+ if (PG_O_DIRECT != 0 )
410+ printf ("** This non-direct I/O option is not used by Postgres.\n" );
411+ #endif
378412}
379413
380414void
@@ -389,6 +423,8 @@ test_open_syncs(void)
389423printf ("(This is designed to compare the cost of one large\n" );
390424printf ("sync'ed write and two smaller sync'ed writes.)\n" );
391425
426+ /* XXX no PG_O_DIRECT */
427+
392428/*
393429 * Test open_sync with different size files
394430 */