Skip to contentSkip to conversation

fix some rbd-fuse related issues

PATCH In review Danny Al-Gaaf 2 participants 6 messages Jan 28, 2013

lore
Share & tools
lore
#0 lore raw

cover fix some rbd-fuse related issues

Here three patches to fix some issues with the new rbd-fuse code and an issues with the fuse handling in configure.

Danny Al-Gaaf (3):
configure: fix check for fuse_getgroups()
rbd-fuse: fix usage of conn->want
rbd-fuse: fix printf format for off_t and size_t

 configure.ac            |  8 ++++----
 src/rbd_fuse/rbd-fuse.c | 12 +++++++-----
 2 files changed, 11 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.1.1
#1 lore raw

PATCH 1/3 configure: fix check for fuse_getgroups()

Check for fuse_getgroups() only in case we have found libfuse already. Moved the check to the check for --with-fuse.

Small fix: fix string for NO_ATOMIC_OPS, don't use "'".

---
 configure.ac | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
configure.ac +4 -4
index ffbd150..d6cff80 100644
@@ -241,6 +241,8 @@ AS_IF([test "x$with_fuse" != xno],
                AC_DEFINE([HAVE_LIBFUSE], [1],
                          [Define if you have fuse])
                HAVE_LIBFUSE=1
+	       # look for fuse_getgroups and define FUSE_GETGROUPS if found
+	       AC_CHECK_FUNCS([fuse_getgroups])	       
               ],
              [AC_MSG_FAILURE(
                    [no FUSE found (use --without-fuse to disable)])])])
@@ -391,7 +393,8 @@ AS_IF([test "x$with_libatomic_ops" != xno],
               ])])
 AS_IF([test "$HAVE_ATOMIC_OPS" = "1"],
 	[],
-	AC_DEFINE([NO_ATOMIC_OPS], [1], [Defined if you don't have atomic_ops]))
+	[AC_DEFINE([NO_ATOMIC_OPS], [1], [Defined if you do not have atomic_ops])])
+
 AM_CONDITIONAL(WITH_LIBATOMIC, [test "$HAVE_ATOMIC_OPS" = "1"])
 
 # newsyn?  requires mpi.
@@ -417,9 +420,6 @@ AS_IF([test "x$with_system_leveldb" = xcheck],
 	    [AC_CHECK_LIB([leveldb], [leveldb_open], [with_system_leveldb=yes], [], [-lsnappy -lpthread])])
 AM_CONDITIONAL(WITH_SYSTEM_LEVELDB, [ test "$with_system_leveldb" = "yes" ])
 
-# look for fuse_getgroups and define FUSE_GETGROUPS if found
-AC_CHECK_FUNCS([fuse_getgroups])
-
 # use system libs3?
 AC_ARG_WITH([system-libs3],
 	[AS_HELP_STRING([--with-system-libs3], [use system libs3])],
Signature · 1 line
1.8.1.1
#2 lore raw

PATCH 2/3 rbd-fuse: fix usage of conn->want

In reply to Danny Al-Gaaf

Fix usage of conn->want and FUSE_CAP_BIG_WRITES. Both need libfuse version >= 2.8. Encapsulate the related code line into a check for the needed FUSE_VERSION as already done in ceph-fuse in some cases.

---
 src/rbd_fuse/rbd-fuse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/rbd_fuse/rbd-fuse.c +2 -1
index b3e318f..c204463 100644
@@ -461,8 +461,9 @@ rbdfs_init(struct fuse_conn_info *conn)
 	ret = rados_ioctx_create(cluster, pool_name, &ioctx);
 	if (ret < 0)
 		exit(91);
-
+#if FUSE_VERSION >= FUSE_MAKE_VERSION(2, 8)
 	conn->want |= FUSE_CAP_BIG_WRITES;
+#endif
 	gotrados = 1;
 
 	// init's return value shows up in fuse_context.private_data,
Signature · 1 line
1.8.1.1
#3 lore raw

PATCH 3/3 rbd-fuse: fix printf format for off_t and size_t

In reply to Danny Al-Gaaf

Fix printf format for off_t and size_t to print the same on 32 and 64bit systems. Use PRI* macros from inttypes.h.

---
 src/rbd_fuse/rbd-fuse.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
src/rbd_fuse/rbd-fuse.c +5 -4
index c204463..748976a 100644
@@ -15,6 +15,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <inttypes.h>
 
 #include "include/rbd/librbd.h"
 
@@ -321,7 +322,7 @@ static int rbdfs_write(const char *path, const char *buf, size_t size,
 
 		if (offset + size > rbdsize(fi->fh)) {
 			int r;
-			fprintf(stderr, "rbdfs_write resizing %s to 0x%lx\n",
+			fprintf(stderr, "rbdfs_write resizing %s to 0x%"PRIxMAX"\n",
 				path, offset+size);
 			r = rbd_resize(rbd->image, offset+size);
 			if (r < 0)
@@ -516,7 +517,7 @@ rbdfs_truncate(const char *path, off_t size)
 		return -ENOENT;
 
 	rbd = &opentbl[fd];
-	fprintf(stderr, "truncate %s to %ld (0x%lx)\n", path, size, size);
+	fprintf(stderr, "truncate %s to %"PRIdMAX" (0x%"PRIxMAX")\n", path, size, size);
 	r = rbd_resize(rbd->image, size);
 	if (r < 0)
 		return r;
@@ -559,7 +560,7 @@ rbdfs_setxattr(const char *path, const char *name, const char *value,
 	for (ap = attrs; ap->attrname != NULL; ap++) {
 		if (strcmp(name, ap->attrname) == 0) {
 			*ap->attrvalp = strtoull(value, NULL, 0);
-			fprintf(stderr, "rbd-fuse: %s set to 0x%lx\n",
+			fprintf(stderr, "rbd-fuse: %s set to 0x%"PRIx64"\n",
 				ap->attrname, *ap->attrvalp);
 			return 0;
 		}
@@ -578,7 +579,7 @@ rbdfs_getxattr(const char *path, const char *name, char *value,
 
 	for (ap = attrs; ap->attrname != NULL; ap++) {
 		if (strcmp(name, ap->attrname) == 0) {
-			sprintf(buf, "%lu", *ap->attrvalp);
+			sprintf(buf, "%"PRIu64, *ap->attrvalp);
 			if (value != NULL && size >= strlen(buf))
 				strcpy(value, buf);
 			fprintf(stderr, "rbd-fuse: get %s\n", ap->attrname);
Signature · 1 line
1.8.1.1
#4 lore raw
In reply to Danny Al-Gaaf

Thanks Danny, I'll look at these today.

Quoted 15 lines · Danny Al-Gaaf

Here three patches to fix some issues with the new rbd-fuse code and an issues with the fuse handling in configure.

Danny Al-Gaaf (3):
configure: fix check for fuse_getgroups()
rbd-fuse: fix usage of conn->want
rbd-fuse: fix printf format for off_t and size_t

configure.ac | 8 ++++----
src/rbd_fuse/rbd-fuse.c | 12 +++++++-----

2 files changed, 11 insertions(+), 9 deletions(-)
Signature · 1 line
1.8.1.1
#5 lore raw

Actually Sage merged them into master. Thanks again.

Quoted 19 lines · Dan Mick

Thanks Danny, I'll look at these today.

Quoted 15 lines · Danny Al-Gaaf

Here three patches to fix some issues with the new rbd-fuse code and an issues with the fuse handling in configure.

Danny Al-Gaaf (3):
configure: fix check for fuse_getgroups()
rbd-fuse: fix usage of conn->want
rbd-fuse: fix printf format for off_t and size_t

configure.ac | 8 ++++----
src/rbd_fuse/rbd-fuse.c | 12 +++++++-----

2 files changed, 11 insertions(+), 9 deletions(-)

--
1.8.1.1