From: Samuel Just Date: Thu, 3 Apr 2014 17:39:39 +0000 (-0700) Subject: ReplicatedPG: handle FLAG_OMAP on promote and copyfrom X-Git-Tag: v0.80-rc1~95^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9894a55d3b311f1ec52ba656cb18abb83e2ebe9c;p=ceph.git ReplicatedPG: handle FLAG_OMAP on promote and copyfrom Fixes: #7967 Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 3f729b28421..b7466239699 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -5472,6 +5472,9 @@ void ReplicatedPG::process_copy_chunk(hobject_t oid, ceph_tid_t tid, int r) return; } + if (cop->omap.size()) + cop->results.has_omap = true; + if (r >= 0 && pool.info.require_rollback() && cop->omap.size()) { r = -EOPNOTSUPP; } @@ -5668,6 +5671,14 @@ void ReplicatedPG::finish_copyfrom(OpContext *ctx) --ctx->delta_stats.num_whiteouts; } + if (cb->results->has_omap) { + dout(10) << __func__ << " setting omap flag on " << obs.oi.soid << dendl; + obs.oi.set_flag(object_info_t::FLAG_OMAP); + } else { + dout(10) << __func__ << " clearing omap flag on " << obs.oi.soid << dendl; + obs.oi.clear_flag(object_info_t::FLAG_OMAP); + } + interval_set ch; if (obs.oi.size > 0) ch.insert(0, obs.oi.size); @@ -5744,6 +5755,11 @@ void ReplicatedPG::finish_promote(int r, OpRequestRef op, dout(20) << __func__ << " creating whiteout on " << soid << dendl; osd->logger->inc(l_osd_tier_whiteout); } else { + if (results->has_omap) { + dout(10) << __func__ << " setting omap flag on " << soid << dendl; + tctx->new_obs.oi.set_flag(object_info_t::FLAG_OMAP); + } + tctx->op_t->append(results->final_tx); delete results->final_tx; results->final_tx = NULL; @@ -10861,6 +10877,8 @@ bool ReplicatedPG::agent_maybe_evict(ObjectContextRef& obc) ctx->at_version = get_next_version(); assert(ctx->new_obs.exists); int r = _delete_oid(ctx, true); + if (obc->obs.oi.is_omap()) + ctx->delta_stats.num_objects_omap--; assert(r == 0); finish_ctx(ctx, pg_log_entry_t::DELETE); simple_repop_submit(repop); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 4d6000da8c4..115685225bc 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -123,9 +123,11 @@ public: librados::snap_set_t snapset; ///< src snapset (if head) bool mirror_snapset; map attrs; ///< src user attrs + bool has_omap; CopyResults() : object_size(0), started_temp_obj(false), final_tx(NULL), user_version(0), - should_requeue(false), mirror_snapset(false) {} + should_requeue(false), mirror_snapset(false), + has_omap(false) {} }; struct CopyOp {