]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: clean up check_item_loc() comments
authorSage Weil <sage.weil@dreamhost.com>
Fri, 4 May 2012 01:59:02 +0000 (18:59 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Fri, 4 May 2012 01:59:02 +0000 (18:59 -0700)
Thanks Greg!

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/crush/CrushWrapper.cc
src/crush/CrushWrapper.h

index 9d9307b1f34dc446e93d3735b3bca0a7c29b842e..fc30f2de17973c408508e5e4230a113107ae9cfd 100644 (file)
@@ -66,7 +66,7 @@ int CrushWrapper::remove_item(CephContext *cct, int item)
 }
 
 bool CrushWrapper::check_item_loc(CephContext *cct, int item, map<string,string>& loc,
-                                 float *weight)  // typename -> bucketname
+                                 float *weight)
 {
   ldout(cct, 5) << "check_item_loc item " << item << " loc " << loc << dendl;
 
@@ -96,14 +96,15 @@ bool CrushWrapper::check_item_loc(CephContext *cct, int item, map<string,string>
     crush_bucket *b = get_bucket(id);
     assert(b);
 
-    // make sure the item doesn't already exist in this bucket
-    for (unsigned j=0; j<b->size; j++)
+    // see if item exists in this bucket
+    for (unsigned j=0; j<b->size; j++) {
       if (b->items[j] == cur) {
        ldout(cct, 2) << "check_item_loc " << cur << " exists in bucket " << b->id << dendl;
        if (weight)
          *weight = (float)crush_get_bucket_item_weight(b, j) / (float)0x10000;
        return true;
       }
+    }
     return false;
   }
   
index cd0b32c79a7671fd7f6de6f4f21c0754ad5a6df0..d12cd835fa40a25ee5ba7306bdf672204877d7a2 100644 (file)
@@ -171,6 +171,7 @@ public:
    * @param cct cct
    * @param item item id
    * @param loc location to check (map of type to bucket names)
+   * @param weight optional pointer to weight of item at that location
    */
   bool check_item_loc(CephContext *cct, int item, map<string,string>& loc, float *weight);