summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-10-01 12:24:58 -0700
committerSage Weil <sage@inktank.com>2013-10-01 12:24:58 -0700
commita2fc66793f66d359bdb93549acd6aad0893ac5ce (patch)
tree525e5ac3b999db968797b1e7d17f1444eb1115b5
parent13b8948e051163c60f3291368ea09d278dd30585 (diff)
downloadceph-wip-osd-whiteout.tar.gz
osd/osd_types: convert object_info_t::uses_tmap to a flagwip-osd-whiteout
Treat the second encoded bool as bits 9-16 of a (now) 16-bit flags field, and use bit 9 (what used to be set by the use_tmap bool) as FLAG_USES_TMAP. No encoding compatibility change. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/osd/ReplicatedPG.cc20
-rw-r--r--src/osd/osd_types.cc24
-rw-r--r--src/osd/osd_types.h10
3 files changed, 30 insertions, 24 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index 8adec157e7e..aa20bbb57b8 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -3292,7 +3292,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
if (cct->_conf->osd_tmapput_sets_uses_tmap) {
assert(cct->_conf->osd_auto_upgrade_tmap);
- oi.uses_tmap = true;
+ oi.set_flag(object_info_t::FLAG_USES_TMAP);
}
// write it
@@ -3340,7 +3340,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
}
set<string> out_set;
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
dout(20) << "CEPH_OSD_OP_OMAPGETKEYS: "
<< " Reading " << oi.soid << " omap from tmap" << dendl;
map<string, bufferlist> vals;
@@ -3398,7 +3398,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
}
map<string, bufferlist> out_set;
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
dout(20) << "CEPH_OSD_OP_OMAPGETVALS: "
<< " Reading " << oi.soid << " omap from tmap" << dendl;
map<string, bufferlist> vals;
@@ -3449,7 +3449,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
case CEPH_OSD_OP_OMAPGETHEADER:
++ctx->num_read;
{
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
dout(20) << "CEPH_OSD_OP_OMAPGETHEADER: "
<< " Reading " << oi.soid << " omap from tmap" << dendl;
map<string, bufferlist> vals;
@@ -3480,7 +3480,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
goto fail;
}
map<string, bufferlist> out;
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
dout(20) << "CEPH_OSD_OP_OMAPGET: "
<< " Reading " << oi.soid << " omap from tmap" << dendl;
map<string, bufferlist> vals;
@@ -3579,7 +3579,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
case CEPH_OSD_OP_OMAPSETVALS:
++ctx->num_write;
{
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
_copy_up_tmap(ctx);
}
if (!obs.exists) {
@@ -3609,7 +3609,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
case CEPH_OSD_OP_OMAPSETHEADER:
++ctx->num_write;
{
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
_copy_up_tmap(ctx);
}
if (!obs.exists) {
@@ -3629,7 +3629,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
result = -ENOENT;
break;
}
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
_copy_up_tmap(ctx);
}
t.touch(coll, soid);
@@ -3645,7 +3645,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
result = -ENOENT;
break;
}
- if (oi.uses_tmap && cct->_conf->osd_auto_upgrade_tmap) {
+ if (oi.test_flag(object_info_t::FLAG_USES_TMAP) && cct->_conf->osd_auto_upgrade_tmap) {
_copy_up_tmap(ctx);
}
t.touch(coll, soid);
@@ -3824,7 +3824,7 @@ int ReplicatedPG::_get_tmap(OpContext *ctx,
int ReplicatedPG::_copy_up_tmap(OpContext *ctx)
{
dout(20) << "copying up tmap for " << ctx->new_obs.oi.soid << dendl;
- ctx->new_obs.oi.uses_tmap = false;
+ ctx->new_obs.oi.clear_flag(object_info_t::FLAG_USES_TMAP);
map<string, bufferlist> vals;
bufferlist header;
int r = _get_tmap(ctx, &vals, &header);
diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc
index e8960584c25..952f0cf75d7 100644
--- a/src/osd/osd_types.cc
+++ b/src/osd/osd_types.cc
@@ -2798,7 +2798,6 @@ void object_info_t::copy_user_bits(const object_info_t& other)
truncate_size = other.truncate_size;
flags = other.flags;
category = other.category;
- uses_tmap = other.uses_tmap;
}
ps_t object_info_t::legacy_object_locator_to_ps(const object_t &oid,
@@ -2839,13 +2838,15 @@ void object_info_t::encode(bufferlist& bl) const
::encode(snaps, bl);
::encode(truncate_seq, bl);
::encode(truncate_size, bl);
- ::encode((__u8)flags, bl);
+ __u8 flags_lo = flags & 0xff;
+ __u8 flags_hi = (flags & 0xff00) >> 8;
+ ::encode(flags_lo, bl);
::encode(old_watchers, bl);
/* shenanigans to avoid breaking backwards compatibility in the disk format.
* When we can, switch this out for simply putting the version_t on disk. */
eversion_t user_eversion(0, user_version);
::encode(user_eversion, bl);
- ::encode(uses_tmap, bl);
+ ::encode(flags_hi, bl);
::encode(watchers, bl);
ENCODE_FINISH(bl);
}
@@ -2884,9 +2885,9 @@ void object_info_t::decode(bufferlist::iterator& bl)
::decode(truncate_seq, bl);
::decode(truncate_size, bl);
if (struct_v >= 3) {
- __u8 f;
- ::decode(f, bl);
- flags = (flag_t)f;
+ __u8 lo;
+ ::decode(lo, bl);
+ flags = (flag_t)lo;
} else {
flags = (flag_t)0;
}
@@ -2896,10 +2897,13 @@ void object_info_t::decode(bufferlist::iterator& bl)
::decode(user_eversion, bl);
user_version = user_eversion.version;
}
- if (struct_v >= 9)
- ::decode(uses_tmap, bl);
- else
- uses_tmap = true;
+ if (struct_v >= 9) {
+ __u8 hi;
+ ::decode(hi, bl);
+ flags = (flag_t)(flags | ((unsigned)hi << 8));
+ } else {
+ set_flag(FLAG_USES_TMAP);
+ }
if (struct_v < 10)
soid.pool = myoloc.pool;
if (struct_v >= 11) {
diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h
index 903222749a2..240040a308d 100644
--- a/src/osd/osd_types.h
+++ b/src/osd/osd_types.h
@@ -2094,10 +2094,13 @@ struct object_info_t {
uint64_t size;
utime_t mtime;
- // note: these are currently encoded into 8 bits; see encode()/decode()
+ // note: these are currently encoded into a total 16 bits; see
+ // encode()/decode() for the weirdness.
typedef enum {
FLAG_LOST = 1<<0,
FLAG_WHITEOUT = 1<<1, // object logically does not exist
+ // ...
+ FLAG_USES_TMAP = 1<<8,
} flag_t;
flag_t flags;
@@ -2108,7 +2111,6 @@ struct object_info_t {
map<pair<uint64_t, entity_name_t>, watch_info_t> watchers;
- bool uses_tmap;
void copy_user_bits(const object_info_t& other);
@@ -2142,13 +2144,13 @@ struct object_info_t {
explicit object_info_t()
: user_version(0), size(0), flags((flag_t)0),
- truncate_seq(0), truncate_size(0), uses_tmap(false)
+ truncate_seq(0), truncate_size(0)
{}
object_info_t(const hobject_t& s)
: soid(s),
user_version(0), size(0), flags((flag_t)0),
- truncate_seq(0), truncate_size(0), uses_tmap(false) {}
+ truncate_seq(0), truncate_size(0) {}
object_info_t(bufferlist& bl) {
decode(bl);