]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Add rbd_skip_partial_discard flag 4221/head
authorXiaoxi Chen <xiaoxi.chen@intel.com>
Mon, 30 Mar 2015 11:56:59 +0000 (19:56 +0800)
committerXiaoxi Chen <xiaoxi.chen@intel.com>
Wed, 1 Apr 2015 06:43:23 +0000 (14:43 +0800)
If we want to discard a range of an object, we will zero(use fallocate
to punch a hole) the range now. In general this introduce some overhead(extra writes).

If the filesystem ontop of RBD holding lots of small files, this
behavior will bring big performance penalty.

Adding a flag that allow user to control if they want to zero the
range.

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
src/common/config_opts.h
src/librbd/internal.cc

index 2b9c7e778ef09593c919ce0041170b475c4afa9b..f6713d39972c5f29d27a84b415ed06ebc6482754 100644 (file)
@@ -892,6 +892,7 @@ OPTION(rbd_clone_copy_on_read, OPT_BOOL, false)
 OPTION(rbd_blacklist_on_break_lock, OPT_BOOL, true) // whether to blacklist clients whose lock was broken
 OPTION(rbd_blacklist_expire_seconds, OPT_INT, 0) // number of seconds to blacklist - set to 0 for OSD default
 OPTION(rbd_request_timed_out_seconds, OPT_INT, 30) // number of seconds before maint request times out
+OPTION(rbd_skip_partial_discard, OPT_BOOL, false) // when trying to discard a range inside an object, set to true to skip zeroing the range.
 
 /*
  * The following options change the behavior for librbd's image creation methods that
index 2f1d8ca80943b3e7993a6fa5dd669535f86974d6..07f952a9f8af0c92d7f4df329ccf5ec63c87b258 100644 (file)
@@ -3576,9 +3576,13 @@ reprotect_and_return_err:
        req = new AioTruncate(ictx, p->oid.name, p->objectno, p->offset, objectx, object_overlap,
                              snapc, snap_id, req_comp);
       } else {
-       req = new AioZero(ictx, p->oid.name, p->objectno, p->offset, p->length,
-                         objectx, object_overlap,
-                         snapc, snap_id, req_comp);
+       if(ictx->cct->_conf->rbd_skip_partial_discard) {
+         continue;
+       } else {
+         req = new AioZero(ictx, p->oid.name, p->objectno, p->offset, p->length,
+                           objectx, object_overlap,
+                           snapc, snap_id, req_comp);
+       }
       }
 
       r = req->send();