]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
filestore: add option to disable use of btrfs clone range ioctl
authorSage Weil <sage@newdream.net>
Wed, 28 Jul 2010 22:00:54 +0000 (15:00 -0700)
committerSage Weil <sage@newdream.net>
Wed, 28 Jul 2010 22:00:54 +0000 (15:00 -0700)
src/config.cc
src/config.h
src/os/FileStore.cc

index 9a63c83e502182ea8c4673eff77b80f59854f78c..305789a21fbc23b2ac78595c49835bf1b46a9d98 100644 (file)
@@ -495,6 +495,7 @@ static struct config_option config_optionsp[] = {
        OPTION(filestore_dev, 0, OPT_STR, 0),
        OPTION(filestore_btrfs_trans, 0, OPT_BOOL, true),
        OPTION(filestore_btrfs_snap, 0, OPT_BOOL, false),
+       OPTION(filestore_btrfs_clone_range, 0, OPT_BOOL, true),
        OPTION(filestore_flusher, 0, OPT_BOOL, true),
        OPTION(filestore_flusher_max_fds, 0, OPT_INT, 512),
        OPTION(filestore_sync_flush, 0, OPT_BOOL, false),
index b100f2741dcfe479050f487552a8c22b65551967..ec263266befcef035080a922e46f5287316a336b 100644 (file)
@@ -367,6 +367,7 @@ struct md_config_t {
   const char  *filestore_dev;
   bool filestore_btrfs_trans;
   bool filestore_btrfs_snap;
+  bool filestore_btrfs_clone_range;
   bool filestore_flusher;
   int filestore_flusher_max_fds;
   bool filestore_sync_flush;
index f76e84856efb553a8c391e0888e0a9bc5b5469dc..22c53594d890571c7a7efa7c6b888ea820b1f38f 100644 (file)
@@ -471,13 +471,17 @@ int FileStore::_detect_fs()
     btrfs = true;
 
     // clone_range?
-    btrfs_clone_range = true;
-    int r = _do_clone_range(fsid_fd, -1, 0, 1);
-    if (r == -EBADF) {
-      dout(0) << "mount btrfs CLONE_RANGE ioctl is supported" << dendl;
+    if (g_conf.filestore_btrfs_clone_range) {
+      btrfs_clone_range = true;
+      int r = _do_clone_range(fsid_fd, -1, 0, 1);
+      if (r == -EBADF) {
+       dout(0) << "mount btrfs CLONE_RANGE ioctl is supported" << dendl;
+      } else {
+       btrfs_clone_range = false;
+       dout(0) << "mount btrfs CLONE_RANGE ioctl is NOT supported: " << strerror_r(-r, buf, sizeof(buf)) << dendl;
+      }
     } else {
-      btrfs_clone_range = false;
-      dout(0) << "mount btrfs CLONE_RANGE ioctl is NOT supported: " << strerror_r(-r, buf, sizeof(buf)) << dendl;
+      dout(0) << "mount btrfs CLONE_RANGE ioctl is DISABLED via 'filestore btrfs clone range' option" << dendl;
     }
 
     // snap_create and snap_destroy?