From: Jason Dillaman Date: Sat, 24 Jan 2015 09:44:09 +0000 (-0500) Subject: rbd: only enable object map if enabled in ceph config X-Git-Tag: v0.93~143^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8fa376776791b7c16a9d3a9ee97045d66db1cd38;p=ceph.git rbd: only enable object map if enabled in ceph config As a way to introduce the RBD object map as an optional tech preview, only enable it for new images/clones if the rbd_object_map configuration parameter is enabled. Signed-off-by: Jason Dillaman --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index d7f53cebf24c..add8176272e3 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -855,6 +855,7 @@ OPTION(rbd_readahead_trigger_requests, OPT_INT, 10) // number of sequential requ OPTION(rbd_readahead_max_bytes, OPT_LONGLONG, 512 * 1024) // set to 0 to disable readahead OPTION(rbd_readahead_disable_after_bytes, OPT_LONGLONG, 50 * 1024 * 1024) // how many bytes are read in total before readahead is disabled OPTION(rbd_clone_copy_on_read, OPT_BOOL, false) +OPTION(rbd_object_map, OPT_BOOL, false) // whether to enable the RBD object map /* * The following options change the behavior for librbd's image creation methods that diff --git a/src/rbd.cc b/src/rbd.cc index da35e8c2e7bd..866906c900be 100644 --- a/src/rbd.cc +++ b/src/rbd.cc @@ -439,8 +439,10 @@ static int do_create(librbd::RBD &rbd, librados::IoCtx& io_ctx, r = rbd.create(io_ctx, imgname, size, order); } else { if (features == 0) { - features = RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK | - RBD_FEATURE_OBJECT_MAP; + features = RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK; + } + if (g_conf->rbd_object_map) { + features |= RBD_FEATURE_OBJECT_MAP; } if ((stripe_unit || stripe_count) && (stripe_unit != (1ull << *order) && stripe_count != 1)) { @@ -459,10 +461,15 @@ static int do_clone(librbd::RBD &rbd, librados::IoCtx &p_ioctx, librados::IoCtx &c_ioctx, const char *c_name, uint64_t features, int *c_order) { - if (features == 0) - features = RBD_FEATURES_ALL; - else if ((features & RBD_FEATURE_LAYERING) != RBD_FEATURE_LAYERING) + if (features == 0) { + features = (RBD_FEATURES_ALL & ~RBD_FEATURE_OBJECT_MAP); + } + else if ((features & RBD_FEATURE_LAYERING) != RBD_FEATURE_LAYERING) { return -EINVAL; + } + if (g_conf->rbd_object_map) { + features |= RBD_FEATURE_OBJECT_MAP; + } return rbd.clone(p_ioctx, p_name, p_snapname, c_ioctx, c_name, features, c_order); @@ -2472,8 +2479,7 @@ int main(int argc, const char **argv) bool format_specified = false, output_format_specified = false; int format = 1; - uint64_t features = RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK | - RBD_FEATURE_OBJECT_MAP; + uint64_t features = RBD_FEATURE_LAYERING | RBD_FEATURE_EXCLUSIVE_LOCK; const char *imgname = NULL, *snapname = NULL, *destname = NULL, *dest_poolname = NULL, *dest_snapname = NULL, *path = NULL, *devpath = NULL, *lock_cookie = NULL, *lock_client = NULL,