From: Sage Weil Date: Thu, 14 Mar 2019 18:07:29 +0000 (-0500) Subject: crush/CrushWrapper: create_or_move: make weight-set update optional X-Git-Tag: v15.0.0~144^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=07bb2020376294067d3df1423c2a3e835870f9f3;p=ceph.git crush/CrushWrapper: create_or_move: make weight-set update optional Signed-off-by: Sage Weil --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 8b12c3db3ab..dd0d9df326a 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1316,7 +1316,8 @@ int CrushWrapper::link_bucket( int CrushWrapper::create_or_move_item( CephContext *cct, int item, float weight, string name, - const map& loc) // typename -> bucketname + const map& loc, // typename -> bucketname + bool init_weight_sets) { int ret = 0; int old_iweight; @@ -1337,7 +1338,8 @@ int CrushWrapper::create_or_move_item( ldout(cct, 5) << "create_or_move_item adding " << item << " weight " << weight << " at " << loc << dendl; - ret = insert_item(cct, item, weight, name, loc); + ret = insert_item(cct, item, weight, name, loc, + item >= 0 && init_weight_sets); if (ret == 0) ret = 1; // changed } diff --git a/src/crush/CrushWrapper.h b/src/crush/CrushWrapper.h index 0fd2b3723b9..9a3c12a8422 100644 --- a/src/crush/CrushWrapper.h +++ b/src/crush/CrushWrapper.h @@ -868,10 +868,12 @@ public: * @param weight initial item weight (if we need to create it) * @param name item name * @param loc location (map of type to bucket names) + * @param init_weight_sets initialize weight-set values to weight (vs 0) * @return 0 for no change, 1 for successful change, negative on error */ int create_or_move_item(CephContext *cct, int item, float weight, string name, - const map& loc); + const map& loc, + bool init_weight_sets=true); /** * remove all instances of an item from the map