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
}
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;
}
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;
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;
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;
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) {
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) {
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);
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);
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);
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,
::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);
}
::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;
}
::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) {
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;
map<pair<uint64_t, entity_name_t>, watch_info_t> watchers;
- bool uses_tmap;
void copy_user_bits(const object_info_t& other);
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);