2011-06-10 07:15:31

by Andreas Dilger

[permalink] [raw]
Subject: [PATCH] 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 <[email protected]>
---
lib/ext2fs/unix_io.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

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
--
1.7.3.4



2011-06-11 15:50:54

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] ext2fs: don't use O_DIRECT if not available

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 <[email protected]>

Applied to the next branch, thanks.

- Ted