Skip to contentSkip to conversation

ext2fs: don't use O_DIRECT if not available

PATCH Applied Andreas Dilger 2 participants 2 messages Jun 10, 2011 – Jun 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 lib/ext2fs/unix_io.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
lib/ext2fs/unix_io.c +2 -0
index 6e480b7..dddaf6f 100644
@@ -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
Signature · 1 line
1.7.3.4
Applied
#1 lore raw
Quoted 5 lines · Andreas Dilger

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.

Applied to the next branch, thanks.

- Ted