From 3d894362ae0b8d346f29e9c3ea98e325d83a083a Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Fri, 14 Aug 2009 15:51:37 -0700 Subject: fuse: switch off direct I/O mode if big writes are supported --- doc/user-guide/user-guide.texi | 3 ++- glusterfsd/src/glusterfsd.c | 3 ++- xlators/mount/fuse/src/fuse-bridge.c | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/user-guide/user-guide.texi b/doc/user-guide/user-guide.texi index c318341ec7e..800354116a2 100644 --- a/doc/user-guide/user-guide.texi +++ b/doc/user-guide/user-guide.texi @@ -509,7 +509,8 @@ Advanced Options Attribute timeout for inodes in the kernel, in seconds. Defaults to 1 second. @item --disable-direct-io-mode - Disable direct @acronym{I/O} mode in @acronym{FUSE} kernel module. + Disable direct @acronym{I/O} mode in @acronym{FUSE} kernel module. This is set + automatically if kernel supports big writes (>= 2.6.26). @item -e, --entry-timeout= Entry timeout for directory entries in the kernel, in seconds. diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index d658c0e090e..2ad644e9fd4 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -140,7 +140,8 @@ static struct argp_option gf_options[] = { {0, 0, 0, 0, "Fuse options:"}, {"disable-direct-io-mode", ARGP_DISABLE_DIRECT_IO_MODE_KEY, 0, 0, - "Disable direct I/O mode in fuse kernel module"}, + "Disable direct I/O mode in fuse kernel module" + " [default if big writes are supported]"}, {"entry-timeout", ARGP_ENTRY_TIMEOUT_KEY, "SECONDS", 0, "Set entry timeout to SECONDS in fuse kernel module [default: 1]"}, {"attribute-timeout", ARGP_ATTRIBUTE_TIMEOUT_KEY, "SECONDS", 0, diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index d2c08b57eb9..d78de0dd29f 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2635,7 +2635,13 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg) fino.minor = FUSE_KERNEL_MINOR_VERSION; fino.max_readahead = 1 << 17; fino.max_write = 1 << 17; - fino.flags = FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_BIG_WRITES; + fino.flags = FUSE_ASYNC_READ | FUSE_POSIX_LOCKS; + if (fini->minor >= 6 /* fuse_init_in has flags */ && + fini->flags & FUSE_BIG_WRITES) { + /* no need for direct I/O mode if big writes are supported */ + priv->direct_io_mode = 0; + fino.flags |= FUSE_BIG_WRITES; + } ret = send_fuse_obj (this, finh, &fino); if (ret == 0) -- cgit