[sheepdog] [PATCH v3] sheepfs: use big_writes option only when the version of libfuse is equal or greater than 2.8.0

Robin Dong robin.k.dong at gmail.com
Thu Aug 29 03:45:45 CEST 2013


From: Robin Dong <sanbai at taobao.com>

When using sheepfs on rhel5 environment, it will report:

    fuse: unknown option `big_writes'

because the 'big_writes' option is only supported by libfuse with version >= 2.8.0.

So we should add check for version of libfuse in configure.ac.

Signed-off-by: RobinDong <sanbai at taobao.com>
---
 configure.ac   |    3 +++
 sheepfs/core.c |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9e878f5..2e37277 100644
--- a/configure.ac
+++ b/configure.ac
@@ -323,6 +323,9 @@ if test "x${enable_sheepfs}" = xyes; then
 		[#define _FILE_OFFSET_BITS 64])
 	AC_DEFINE_UNQUOTED([HAVE_SHEEPFS], 1, [have sheepfs])
 	PACKAGE_FEATURES="$PACKAGE_FEATURES sheepfs"
+	PKG_CHECK_EXISTS(fuse >= 2.8.0,
+		[AC_DEFINE_UNQUOTED([FUSE_SUPPORT_BIGWRITES],
+			1, [Support -obig_writes for fuse])]);
 fi
 
 if test "x${enable_http}" = xyes; then
diff --git a/sheepfs/core.c b/sheepfs/core.c
index 71253aa..1482596 100644
--- a/sheepfs/core.c
+++ b/sheepfs/core.c
@@ -258,7 +258,9 @@ static int sheepfs_main_loop(char *mountpoint)
 
 	fuse_opt_add_arg(&args, "sheepfs"); /* placeholder for argv[0] */
 	fuse_opt_add_arg(&args, "-oallow_root");
+	#ifdef FUSE_SUPPORT_BIGWRITES
 	fuse_opt_add_arg(&args, "-obig_writes");
+	#endif
 	fuse_opt_add_arg(&args, "-okernel_cache");
 	fuse_opt_add_arg(&args, "-ofsname=sheepfs");
 	fuse_opt_add_arg(&args, mountpoint);
-- 
1.7.3.2




More information about the sheepdog mailing list