Patchwork ext2fs: don't use O_DIRECT if not available

login
register
mail settings
Submitter Andreas Dilger
Date June 10, 2011, 7:15 a.m.
Message ID <1307690130-12227-1-git-send-email-adilger@whamcloud.com>
Download mbox | patch
Permalink /patch/99850/
State Accepted
Headers show

Comments

Andreas Dilger - June 10, 2011, 7:15 a.m.
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>
---
 lib/ext2fs/unix_io.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Theodore Ts'o - June 11, 2011, 3:50 p.m.
On Fri, Jun 10, 2011 at 01:15:30AM -0600, Andreas Dilger wrote:
> 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>

Applied to the next branch, thanks.

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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