Skip to content

Commit

Permalink
Add rbd_skip_partial_discard flag
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
xiaoxichen819 committed Apr 1, 2015
1 parent 497737a commit e7812b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/common/config_opts.h
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions src/librbd/internal.cc
Expand Up @@ -3576,9 +3576,13 @@ namespace librbd {
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();
Expand Down

0 comments on commit e7812b8

Please sign in to comment.