]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
ext2fs: don't use O_DIRECT if not available
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 11 Jun 2011 15:50:01 +0000 (11:50 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 Jun 2011 15:50:01 +0000 (11:50 -0400)
O_DIRECT is not defined on OSX.  Since direct IO is only a new
optimization and not needed for correct functionality, disable
it if O_DIRECT is unavailable.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/unix_io.c

index 6e480b7959d50dc64d8996d059625fb1aca88caa..dddaf6f2b99619f713a6b6deafa76d069daba648 100644 (file)
@@ -474,8 +474,10 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
        open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
        if (flags & IO_FLAG_EXCLUSIVE)
                open_flags |= O_EXCL;
+#ifdef O_DIRECT
        if (flags & IO_FLAG_DIRECT_IO)
                open_flags |= O_DIRECT;
+#endif
        data->flags = flags;
 
 #ifdef HAVE_OPEN64