hobject_t: change default pool id to INT64_MIN

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>
This commit is contained in:
Sage Weil 2014-12-11 16:24:16 -08:00
parent 959a7ce3a1
commit ff99af38df

View 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();
}