Skip to content

Commit

Permalink
Merge pull request #6544 from liewegas/wip-smaller-object-info
Browse files Browse the repository at this point in the history
osd: make encoded object_info_t smaller to fit inside the XFS inode

Reviewed-by: Samuel Just <sjust@redhat.com>
  • Loading branch information
liewegas committed Dec 17, 2015
2 parents d064636 + a9d3f07 commit 9739d4d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/osd/PGBackend.cc
Expand Up @@ -675,7 +675,10 @@ void PGBackend::be_compare_scrubmaps(
update = MAYBE;
}
if (update != NO) {
utime_t age = now - auth_oi.local_mtime;
utime_t mtime = auth_oi.local_mtime;
if (mtime == utime_t())
mtime = auth_oi.mtime;
utime_t age = now - mtime;
if (update == FORCE ||
age > g_conf->osd_deep_scrub_update_digest_min_age) {
dout(20) << __func__ << " will update digest on " << *k << dendl;
Expand Down
22 changes: 18 additions & 4 deletions src/osd/ReplicatedPG.cc
Expand Up @@ -5760,7 +5760,10 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc
ctx->snapset_obc->obs.oi.version = ctx->at_version;
ctx->snapset_obc->obs.oi.last_reqid = ctx->reqid;
ctx->snapset_obc->obs.oi.mtime = ctx->mtime;
ctx->snapset_obc->obs.oi.local_mtime = now;
if (pool.info.is_tier() || pool.info.has_tiers())
ctx->snapset_obc->obs.oi.local_mtime = now;
else
ctx->snapset_obc->obs.oi.local_mtime = utime_t();

bufferlist bv(sizeof(ctx->new_obs.oi));
::encode(ctx->snapset_obc->obs.oi, bv);
Expand Down Expand Up @@ -5801,7 +5804,10 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc
if (ctx->mtime != utime_t()) {
ctx->new_obs.oi.mtime = ctx->mtime;
dout(10) << " set mtime to " << ctx->new_obs.oi.mtime << dendl;
ctx->new_obs.oi.local_mtime = now;
if (pool.info.is_tier() || pool.info.has_tiers())
ctx->new_obs.oi.local_mtime = now;
else
ctx->new_obs.oi.local_mtime = utime_t();
} else {
dout(10) << " mtime unchanged at " << ctx->new_obs.oi.mtime << dendl;
}
Expand Down Expand Up @@ -6515,7 +6521,10 @@ void ReplicatedPG::finish_copyfrom(OpContext *ctx)
obs.oi.user_version = ctx->user_at_version;

obs.oi.set_data_digest(cb->results->data_digest);
obs.oi.set_omap_digest(cb->results->omap_digest);
if (obs.oi.is_omap())
obs.oi.set_omap_digest(cb->results->omap_digest);
else
obs.oi.clear_omap_digest();

obs.oi.truncate_seq = cb->results->truncate_seq;
obs.oi.truncate_size = cb->results->truncate_size;
Expand Down Expand Up @@ -6700,6 +6709,8 @@ void ReplicatedPG::finish_promote(int r, CopyResults *results,
tctx->new_obs.oi.set_data_digest(results->data_digest);
if (results->has_omap)
tctx->new_obs.oi.set_omap_digest(results->omap_digest);
else
tctx->new_obs.oi.clear_omap_digest();
tctx->new_obs.oi.truncate_seq = results->truncate_seq;
tctx->new_obs.oi.truncate_size = results->truncate_size;

Expand Down Expand Up @@ -11421,7 +11432,10 @@ void ReplicatedPG::_scrub(
ctx->at_version = get_next_version();
ctx->mtime = utime_t(); // do not update mtime
ctx->new_obs.oi.set_data_digest(p->second.first);
ctx->new_obs.oi.set_omap_digest(p->second.second);
if (ctx->new_obs.oi.is_omap())
ctx->new_obs.oi.set_omap_digest(p->second.second);
else
ctx->new_obs.oi.clear_omap_digest();
finish_ctx(ctx, pg_log_entry_t::MODIFY, true, true);
ctx->on_finish = new C_ScrubDigestUpdated(this);
simple_repop_submit(repop);
Expand Down
21 changes: 17 additions & 4 deletions src/osd/osd_types.cc
Expand Up @@ -4225,7 +4225,16 @@ void object_info_t::encode(bufferlist& bl) const
++i) {
old_watchers.insert(make_pair(i->first.second, i->second));
}
ENCODE_START(15, 8, bl);

// kludge to reduce xattr size for most rbd objects
int ev = 15;
if (!(flags & FLAG_OMAP_DIGEST) &&
!(flags & FLAG_DATA_DIGEST) &&
local_mtime == utime_t()) {
ev = 13;
}

ENCODE_START(ev, 8, bl);
::encode(soid, bl);
::encode(myoloc, bl); //Retained for compatibility
::encode((__u32)0, bl); // was category, no longer used
Expand All @@ -4250,9 +4259,13 @@ void object_info_t::encode(bufferlist& bl) const
::encode(watchers, bl);
__u32 _flags = flags;
::encode(_flags, bl);
::encode(local_mtime, bl);
::encode(data_digest, bl);
::encode(omap_digest, bl);
if (ev >= 14) {
::encode(local_mtime, bl);
}
if (ev >= 15) {
::encode(data_digest, bl);
::encode(omap_digest, bl);
}
ENCODE_FINISH(bl);
}

Expand Down
2 changes: 1 addition & 1 deletion src/osd/osd_types.h
Expand Up @@ -2959,7 +2959,7 @@ struct object_info_t {
}
void new_object() {
set_data_digest(-1);
set_omap_digest(-1);
clear_omap_digest();
}

void encode(bufferlist& bl) const;
Expand Down

0 comments on commit 9739d4d

Please sign in to comment.