summaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/os')
-rw-r--r--src/os/HashIndex.cc2
-rw-r--r--src/os/ObjectStore.cc6
-rw-r--r--src/os/hobject.cc17
-rw-r--r--src/os/hobject.h36
4 files changed, 37 insertions, 24 deletions
diff --git a/src/os/HashIndex.cc b/src/os/HashIndex.cc
index bf8c3f7b188..4c97c8a69cd 100644
--- a/src/os/HashIndex.cc
+++ b/src/os/HashIndex.cc
@@ -462,7 +462,7 @@ int HashIndex::list_by_hash(const vector<string> &path,
if (j == objects.end()) {
if (min_count > 0 && out->size() > (unsigned)min_count) {
if (next)
- *next = hobject_t("", "", CEPH_NOSNAP, hash_prefix_to_hash(*i));
+ *next = hobject_t("", "", CEPH_NOSNAP, hash_prefix_to_hash(*i), -1);
return 0;
}
*(next_path.rbegin()) = *(i->rbegin());
diff --git a/src/os/ObjectStore.cc b/src/os/ObjectStore.cc
index 2c896d208b4..214f7b2bc6b 100644
--- a/src/os/ObjectStore.cc
+++ b/src/os/ObjectStore.cc
@@ -378,9 +378,9 @@ void ObjectStore::Transaction::generate_test_instances(list<ObjectStore::Transac
t = new Transaction;
coll_t c("foocoll");
coll_t c2("foocoll2");
- hobject_t o1("obj", "", 123, 456);
- hobject_t o2("obj2", "", 123, 456);
- hobject_t o3("obj3", "", 123, 456);
+ hobject_t o1("obj", "", 123, 456, -1);
+ hobject_t o2("obj2", "", 123, 456, -1);
+ hobject_t o3("obj3", "", 123, 456, -1);
t->touch(c, o1);
bufferlist bl;
bl.append("some data");
diff --git a/src/os/hobject.cc b/src/os/hobject.cc
index 77d576870bc..0134b30ebd1 100644
--- a/src/os/hobject.cc
+++ b/src/os/hobject.cc
@@ -5,18 +5,20 @@
void hobject_t::encode(bufferlist& bl) const
{
- ENCODE_START(3, 3, bl);
+ ENCODE_START(4, 3, bl);
::encode(key, bl);
::encode(oid, bl);
::encode(snap, bl);
::encode(hash, bl);
::encode(max, bl);
+ ::encode(nspace, bl);
+ ::encode(pool, bl);
ENCODE_FINISH(bl);
}
void hobject_t::decode(bufferlist::iterator& bl)
{
- DECODE_START_LEGACY_COMPAT_LEN(3, 3, 3, bl);
+ DECODE_START_LEGACY_COMPAT_LEN(4, 3, 3, bl);
if (struct_v >= 1)
::decode(key, bl);
::decode(oid, bl);
@@ -26,6 +28,10 @@ void hobject_t::decode(bufferlist::iterator& bl)
::decode(max, bl);
else
max = false;
+ if (struct_v >= 4) {
+ ::decode(nspace, bl);
+ ::decode(pool, bl);
+ }
DECODE_FINISH(bl);
}
@@ -62,9 +68,9 @@ void hobject_t::generate_test_instances(list<hobject_t*>& o)
o.push_back(new hobject_t);
o.push_back(new hobject_t);
o.back()->max = true;
- o.push_back(new hobject_t(object_t("oname"), string(), 1, 234));
- o.push_back(new hobject_t(object_t("oname2"), string("okey"), CEPH_NOSNAP, 67));
- o.push_back(new hobject_t(object_t("oname3"), string("oname3"), CEPH_SNAPDIR, 910));
+ o.push_back(new hobject_t(object_t("oname"), string(), 1, 234, -1));
+ o.push_back(new hobject_t(object_t("oname2"), string("okey"), CEPH_NOSNAP, 67, 0));
+ o.push_back(new hobject_t(object_t("oname3"), string("oname3"), CEPH_SNAPDIR, 910, 1));
}
ostream& operator<<(ostream& out, const hobject_t& o)
@@ -75,5 +81,6 @@ ostream& operator<<(ostream& out, const hobject_t& o)
if (o.get_key().length())
out << "." << o.get_key();
out << "/" << o.oid << "/" << o.snap;
+ out << "/" << o.nspace << "/" << o.pool;
return out;
}
diff --git a/src/os/hobject.h b/src/os/hobject.h
index ee50f5b1d90..a3f36accd00 100644
--- a/src/os/hobject.h
+++ b/src/os/hobject.h
@@ -30,6 +30,8 @@ struct hobject_t {
snapid_t snap;
uint32_t hash;
bool max;
+ int64_t pool;
+ string nspace;
private:
string key;
@@ -39,19 +41,23 @@ public:
return key;
}
- hobject_t() : snap(0), hash(0), max(false) {}
+ hobject_t() : snap(0), hash(0), max(false), pool(-1) {}
- hobject_t(object_t oid, const string& key, snapid_t snap, uint64_t hash) :
+ hobject_t(object_t oid, const string& key, snapid_t snap, uint64_t hash,
+ int64_t pool) :
oid(oid), snap(snap), hash(hash), max(false),
+ pool(pool),
key(oid.name == key ? string() : key) {}
- hobject_t(const sobject_t &soid, const string &key, uint32_t hash) :
+ hobject_t(const sobject_t &soid, const string &key, uint32_t hash,
+ int64_t pool) :
oid(soid.oid), snap(soid.snap), hash(hash), max(false),
+ pool(pool),
key(soid.oid.name == key ? string() : key) {}
/* 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) {
+ oid(o.oid), snap(o.snap), max(false), pool(-1) {
hash = __gnu_cxx::hash<sobject_t>()(o);
}
@@ -91,14 +97,8 @@ public:
void swap(hobject_t &o) {
hobject_t temp(o);
- o.oid = oid;
- o.key = key;
- o.snap = snap;
- o.hash = hash;
- oid = temp.oid;
- key = temp.key;
- snap = temp.snap;
- hash = temp.hash;
+ o = (*this);
+ (*this) = temp;
}
void encode(bufferlist& bl) const;
@@ -121,9 +121,15 @@ namespace __gnu_cxx {
ostream& operator<<(ostream& out, const hobject_t& o);
-WRITE_EQ_OPERATORS_5(hobject_t, oid, get_key(), snap, hash, max)
+WRITE_EQ_OPERATORS_7(hobject_t, oid, get_key(), snap, hash, max, pool, nspace)
// sort hobject_t's by <max, get_filestore_key(hash), key, oid, snapid>
-WRITE_CMP_OPERATORS_5(hobject_t, max, get_filestore_key(), get_effective_key(), oid, snap)
-
+WRITE_CMP_OPERATORS_7(hobject_t,
+ max,
+ get_filestore_key(),
+ nspace,
+ pool,
+ get_effective_key(),
+ oid,
+ snap)
#endif