summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <samuel.just@dreamhost.com>2011-09-01 16:00:07 -0700
committerSamuel Just <samuel.just@dreamhost.com>2011-09-02 15:06:32 -0700
commita04b15cfdce690db7fb323e5b0256ace0540c5c9 (patch)
tree1d7af2541a6746576eabb648320655296ca79cec
parentba7ab2f64bd520303f7dfb3ab27b202a0673a93d (diff)
downloadceph-a04b15cfdce690db7fb323e5b0256ace0540c5c9.tar.gz
object.h: Update hobject_t to include object locator key
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
-rw-r--r--src/include/object.h16
-rw-r--r--src/osd/osd_types.cc7
2 files changed, 16 insertions, 7 deletions
diff --git a/src/include/object.h b/src/include/object.h
index bc56445fd1e..706caa6bffc 100644
--- a/src/include/object.h
+++ b/src/include/object.h
@@ -261,14 +261,15 @@ namespace __gnu_cxx {
struct hobject_t {
object_t oid;
+ string key;
snapid_t snap;
uint32_t hash;
hobject_t() : snap(0), hash(0) {}
- hobject_t(object_t oid, snapid_t snap, uint32_t hash) :
- oid(oid), snap(snap), hash(hash) {}
- hobject_t(const sobject_t &soid, uint32_t hash) :
- oid(soid.oid), snap(soid.snap), hash(hash) {}
+ hobject_t(object_t oid, const string &key, snapid_t snap, uint32_t hash) :
+ oid(oid), key(key), snap(snap), hash(hash) {}
+ hobject_t(const sobject_t &soid, const string &key, uint32_t hash) :
+ oid(soid.oid), key(key), snap(soid.snap), hash(hash) {}
/* Do not use when a particular hash function is needed */
explicit hobject_t(const sobject_t &o) :
@@ -279,9 +280,11 @@ struct hobject_t {
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;
}
@@ -291,8 +294,9 @@ struct hobject_t {
}
void encode(bufferlist& bl) const {
- __u8 version = 0;
+ __u8 version = 1;
::encode(version, bl);
+ ::encode(key, bl);
::encode(oid, bl);
::encode(snap, bl);
::encode(hash, bl);
@@ -300,6 +304,8 @@ struct hobject_t {
void decode(bufferlist::iterator& bl) {
__u8 version;
::decode(version, bl);
+ if (version >= 1)
+ ::decode(key, bl);
::decode(oid, bl);
::decode(snap, bl);
::decode(hash, bl);
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc
index 75a93ca73fd..2bdf099d0cf 100644
--- a/src/osd/osd_types.cc
+++ b/src/osd/osd_types.cc
@@ -574,7 +574,7 @@ ps_t object_info_t::legacy_object_locator_to_ps(const object_t &oid,
void object_info_t::encode(bufferlist& bl) const
{
- const __u8 v = 6;
+ const __u8 v = 7;
::encode(v, bl);
::encode(soid, bl);
::encode(oloc, bl);
@@ -603,12 +603,15 @@ void object_info_t::decode(bufferlist::iterator& bl)
sobject_t obj;
::decode(obj, bl);
::decode(oloc, bl);
- soid = hobject_t(obj.oid, obj.snap, 0);
+ soid = hobject_t(obj.oid, oloc.key, obj.snap, 0);
soid.hash = legacy_object_locator_to_ps(soid.oid, oloc);
} else if (v >= 6) {
::decode(soid, bl);
::decode(oloc, bl);
+ if (v == 6)
+ soid.key = oloc.key;
}
+
if (v >= 5)
::decode(category, bl);
::decode(version, bl);