Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4098c88

Browse files
committed
Macro alignment cleanup.
1 parent f76f24d commit 4098c88

File tree

1 file changed

+26
-17
lines changed
  • src/backend/access/transam

1 file changed

+26
-17
lines changed

src/backend/access/transam/xlog.c

+26-17
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.208 2005/07/08 04:07:26 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.209 2005/07/23 15:29:47 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -47,47 +47,56 @@
4747
#include "utils/relcache.h"
4848

4949

50+
/*
51+
* Becauase O_DIRECT bypasses the kernel buffers, and because we never
52+
* read those buffers except during crash recovery, it seems like
53+
* a win to use it in all cases.
54+
*/
55+
#ifdef O_DIRECT
56+
#define PG_O_DIRECT O_DIR(enableFsync ? (open_sync_bit | O_DIRECT) : 0)
57+
#else
58+
5059
/*
5160
* This chunk of hackery attempts to determine which file sync methods
5261
* are available on the current platform, and to choose an appropriate
5362
* default method. We assume that fsync() is always available, and that
5463
* configure determined whether fdatasync() is.
5564
*/
5665
#if defined(O_SYNC)
57-
#define OPEN_SYNC_FLAG O_SYNC
66+
#define OPEN_SYNC_FLAG O_SYNC
5867
#else
5968
#if defined(O_FSYNC)
60-
#define OPEN_SYNC_FLAG O_FSYNC
69+
#define OPEN_SYNC_FLAG O_FSYNC
6170
#endif
6271
#endif
6372

6473
#if defined(O_DSYNC)
6574
#if defined(OPEN_SYNC_FLAG)
6675
#if O_DSYNC != OPEN_SYNC_FLAG
67-
#define OPEN_DATASYNC_FLAG O_DSYNC
76+
#define OPEN_DATASYNC_FLAG O_DSYNC
6877
#endif
6978
#else /* !defined(OPEN_SYNC_FLAG) */
7079
/* Win32 only has O_DSYNC */
71-
#define OPEN_DATASYNC_FLAG O_DSYNC
80+
#define OPEN_DATASYNC_FLAG O_DSYNC
7281
#endif
7382
#endif
7483

7584
#if defined(OPEN_DATASYNC_FLAG)
76-
#define DEFAULT_SYNC_METHOD_STR "open_datasync"
77-
#define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN
78-
#define DEFAULT_SYNC_FLAGBIT OPEN_DATASYNC_FLAG
85+
#define DEFAULT_SYNC_METHOD_STR "open_datasync"
86+
#define DEFAULT_SYNC_METHOD SYNC_METHOD_OPEN
87+
#define DEFAULT_SYNC_FLAGBIT OPEN_DATASYNC_FLAG
7988
#elif defined(HAVE_FDATASYNC)
80-
#define DEFAULT_SYNC_METHOD_STR "fdatasync"
81-
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
82-
#define DEFAULT_SYNC_FLAGBIT 0
89+
#define DEFAULT_SYNC_METHOD_STR "fdatasync"
90+
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FDATASYNC
91+
#define DEFAULT_SYNC_FLAGBIT 0
8392
#elif !defined(HAVE_FSYNC_WRITETHROUGH_ONLY)
84-
#define DEFAULT_SYNC_METHOD_STR "fsync"
85-
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC
86-
#define DEFAULT_SYNC_FLAGBIT 0
93+
#define DEFAULT_SYNC_METHOD_STR "fsync"
94+
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC
95+
#define DEFAULT_SYNC_FLAGBIT 0
8796
#else
88-
#define DEFAULT_SYNC_METHOD_STR "fsync_writethrough"
89-
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC_WRITETHROUGH
90-
#define DEFAULT_SYNC_FLAGBIT 0
97+
#define DEFAULT_SYNC_METHOD_STR "fsync_writethrough"
98+
#define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC_WRITETHROUGH
99+
#define DEFAULT_SYNC_FLAGBIT 0
91100
#endif
92101

93102

0 commit comments

Comments
 (0)