[sheepdog] [PATCH v2] 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
Wed Aug 28 11:00:36 CEST 2013


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 use pkg-config to check version of libfuse.

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..6ebd6a1 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"
+	if [[[ `pkg-config --modversion fuse|sed s/\\\.//g` -ge 280 ]]]; then
+		AC_DEFINE_UNQUOTED([FUSE_SUPPORT_BIGWRITES], 1, [Support -obig_writes for fuse])
+	fi
 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