]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
hobject_t: change default pool id to INT64_MIN
authorSage Weil <sage@redhat.com>
Fri, 12 Dec 2014 00:24:16 +0000 (16:24 -0800)
committerSage Weil <sage@redhat.com>
Fri, 19 Jun 2015 00:02:45 +0000 (17:02 -0700)
We are including pool in a (more) significant part of the sort and using
negative pool IDs; the default must be the most negative (min) so that
it is a useful starting point for a search.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/hobject.h

index 3e2f0d1823ab2e6581942c0122589e0ec6a8d4d9..e71fa0e034c9cd5ffc765868c935e219f890c5a7 100644 (file)
@@ -29,6 +29,13 @@ namespace ceph {
   class Formatter;
 }
 
+#ifndef UINT64_MAX
+#define UINT64_MAX (18446744073709551615ULL)
+#endif
+#ifndef INT64_MIN
+#define INT64_MIN ((int64_t)0x8000000000000000ll)
+#endif
+
 struct hobject_t {
   object_t oid;
   snapid_t snap;
@@ -79,7 +86,7 @@ public:
     return pool == POOL_META;
   }
 
-  hobject_t() : snap(0), hash(0), max(false), pool(-1) {
+  hobject_t() : snap(0), hash(0), max(false), pool(INT64_MIN) {
     build_filestore_key_cache();
   }
 
@@ -144,7 +151,7 @@ public:
 
   /* Do not use when a particular hash function is needed */
   explicit hobject_t(const sobject_t &o) :
-    oid(o.oid), snap(o.snap), max(false), pool(-1) {
+    oid(o.oid), snap(o.snap), max(false), pool(POOL_META) {
     set_hash(CEPH_HASH_NAMESPACE::hash<sobject_t>()(o));
   }
 
@@ -162,7 +169,7 @@ public:
     return snap == 0 &&
           hash == 0 &&
           !max &&
-          pool == -1;
+          pool == INT64_MIN;
   }
 
   static uint32_t _reverse_nibbles(uint32_t retval) {
@@ -252,10 +259,6 @@ WRITE_CMP_OPERATORS_7(hobject_t,
 
 typedef version_t gen_t;
 
-#ifndef UINT64_MAX
-#define UINT64_MAX (18446744073709551615ULL)
-#endif
-
 struct ghobject_t {
   hobject_t hobj;
   gen_t generation;
@@ -275,7 +278,7 @@ public:
     return ghobject_t(h, NO_GEN, shard);
   }
   bool is_pgmeta() const {
-    // make sure we are distinct from hobject_t(), which has pool -1
+    // make sure we are distinct from hobject_t(), which has pool INT64_MIN
     return hobj.pool >= 0 && hobj.oid.name.empty();
   }