]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
use explicit ghobject_t comparators
authorSage Weil <sage@redhat.com>
Thu, 23 Jul 2015 14:20:47 +0000 (10:20 -0400)
committerSage Weil <sage@redhat.com>
Fri, 7 Aug 2015 14:16:04 +0000 (10:16 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/DBObjectMap.cc
src/os/FileStore.cc
src/os/GenericObjectMap.cc
src/os/MemStore.cc
src/test/objectstore/store_test.cc
src/test/osd/types.cc

index 43dba25f2f51cae096e228e3af3144fff9202c15..8ff7ef78fa57282c4c862d7b75f3f6ba29d94a9d 100644 (file)
@@ -887,10 +887,10 @@ int DBObjectMap::clone(const ghobject_t &oid,
   if (oid == target)
     return 0;
 
-  MapHeaderLock _l1(this, MIN(oid, target));
-  MapHeaderLock _l2(this, MAX(oid, target));
+  MapHeaderLock _l1(this, MIN_GHOBJ(oid, target, true));
+  MapHeaderLock _l2(this, MAX_GHOBJ(oid, target, true));
   MapHeaderLock *lsource, *ltarget;
-  if (oid > target) {
+  if (cmp_bitwise(oid, target) > 0) {
     lsource = &_l2;
     ltarget= &_l1;
   } else {
index aace0544f545d246b7b47a1ada7dede69cfa5ca2..2dcf51e8b8e0f1e277843d451f21002ad07c2bc6 100644 (file)
@@ -4680,7 +4680,7 @@ int FileStore::collection_list(coll_t c, ghobject_t start, ghobject_t end,
   sep.hobj.pool = -1;
   sep.set_shard(shard);
   if (!c.is_temp() && !c.is_meta()) {
-    if (start < sep) {
+    if (cmp_bitwise(start, sep) < 0) { // bitwise vs nibble doesn't matter here
       dout(10) << __func__ << " first checking temp pool" << dendl;
       coll_t temp = c.get_temp();
       int r = collection_list(temp, start, end, sort_bitwise, max, ls, next);
index 207236a7547ba43fec2dc5040dae69cf365c314c..a397a05724cd4a85544ee542fc8ecdc6a9b99618 100644 (file)
@@ -1101,14 +1101,14 @@ int GenericObjectMap::list_objects(const coll_t &cid, ghobject_t start, ghobject
       break;
     }
 
-    if (header.oid >= end) {
+    if (cmp_bitwise(header.oid, end) >= 0) {
       if (next)
        *next = ghobject_t::get_max();
       break;
     }
 
-    assert(start <= header.oid);
-    assert(header.oid < end);
+    assert(cmp_bitwise(start, header.oid) <= 0);
+    assert(cmp_bitwise(header.oid, end) < 0);
 
 
     size++;
index 781564438729a5c97952bd7ee9117284ffb4688c..0683d6ab3daa9648bf401006bcd4365316efbbbe 100644 (file)
@@ -434,8 +434,8 @@ int MemStore::collection_list(coll_t cid, ghobject_t start, ghobject_t end,
 
   map<ghobject_t,ObjectRef,ghobject_t::BitwiseComparator>::iterator p = c->object_map.lower_bound(start);
   while (p != c->object_map.end() &&
-         ls->size() < (unsigned)max &&
-         p->first < end) {
+        ls->size() < (unsigned)max &&
+        cmp_bitwise(p->first, end) < 0) {
     ls->push_back(p->first);
     ++p;
   }
index b21d6a7cc19ff8bbba32d29eeaf1cfbd6b541481..7519e2ffee1ef8efd414febc796efe9567e93683 100644 (file)
@@ -329,24 +329,24 @@ TEST_P(StoreTest, Sort) {
     ASSERT_EQ(a, b);
     b.oid.name = "b";
     ASSERT_NE(a, b);
-    ASSERT_LT(a, b);
+    ASSERT_TRUE(cmp_bitwise(a, b) < 0);
     a.pool = 1;
     b.pool = 2;
-    ASSERT_LT(a, b);
+    ASSERT_TRUE(cmp_bitwise(a, b) < 0);
     a.pool = 3;
-    ASSERT_GT(a, b);
+    ASSERT_TRUE(cmp_bitwise(a, b) > 0);
   }
   {
     ghobject_t a(hobject_t(sobject_t("a", CEPH_NOSNAP)));
     ghobject_t b(hobject_t(sobject_t("b", CEPH_NOSNAP)));
     a.hobj.pool = 1;
     b.hobj.pool = 1;
-    ASSERT_LT(a, b);
+    ASSERT_TRUE(cmp_bitwise(a, b) < 0);
     a.hobj.pool = -3;
-    ASSERT_LT(a, b);
+    ASSERT_TRUE(cmp_bitwise(a, b) < 0);
     a.hobj.pool = 1;
     b.hobj.pool = -3;
-    ASSERT_GT(a, b);
+    ASSERT_TRUE(cmp_bitwise(a, b) > 0);
   }
 }
 
index 63b64486217eac34dc1bb0e03b2c5fd0302d39bf..b69a88a1c4e79d1d8114d4a69ba829250aced8da 100644 (file)
@@ -1378,14 +1378,14 @@ TEST(ghobject_t, cmp) {
   sep.set_shard(shard_id_t(1));
   sep.hobj.pool = -1;
   cout << min << " < " << sep << std::endl;
-  ASSERT_LT(min, sep);
+  ASSERT_TRUE(cmp_bitwise(min, sep) < 0);
 
   sep.set_shard(shard_id_t::NO_SHARD);
   cout << "sep shard " << sep.shard_id << std::endl;
   ghobject_t o(hobject_t(object_t(), string(), CEPH_NOSNAP, 0x42,
                         1, string()));
   cout << "o " << o << std::endl;
-  ASSERT_GT(o, sep);
+  ASSERT_TRUE(cmp_bitwise(o, sep) > 0);
 }
 
 /*