]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushWrapper: create_or_move: make weight-set update optional
authorSage Weil <sage@redhat.com>
Thu, 14 Mar 2019 18:07:29 +0000 (13:07 -0500)
committerSage Weil <sage@redhat.com>
Fri, 22 Mar 2019 10:02:25 +0000 (05:02 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 07bb2020376294067d3df1423c2a3e835870f9f3)

src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h

index 8b12c3db3abbdc84deb8bad091adb9c9814d4a9d..dd0d9df326a383ca47cbbc50bdc32a73c02cb0db 100644 (file)
@@ -1316,7 +1316,8 @@ int CrushWrapper::link_bucket(
 
 int CrushWrapper::create_or_move_item(
   CephContext *cct, int item, float weight, string name,
-  const map<string,string>& loc)  // typename -> bucketname
+  const map<string,string>& 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
   }
index 0fd2b3723b95f6c91aeeaa4cc8b875fa0ee6d808..9a3c12a842208c4b73e275c981a6a2bcc9b27a20 100644 (file)
@@ -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<string,string>& loc);
+                         const map<string,string>& loc,
+                         bool init_weight_sets=true);
 
   /**
    * remove all instances of an item from the map