From: Andreas Dilger Date: Sat, 11 Jun 2011 15:50:01 +0000 (-0400) Subject: ext2fs: don't use O_DIRECT if not available X-Git-Tag: v1.42-WIP-0702~18 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=534a4c3db58064caee4fc3e9e294251240d9d28a;p=tools%2Fe2fsprogs.git ext2fs: don't use O_DIRECT if not available 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 Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index 6e480b7..dddaf6f 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -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