From: myoungwon oh Date: Fri, 31 Jul 2020 07:34:23 +0000 (+0900) Subject: osd: do not trigger clone when set_chunk is called X-Git-Tag: v16.1.0~1248^2~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c9997ffdd262c179ede715826c94b1a0ee6d6790;p=ceph.git osd: do not trigger clone when set_chunk is called Signed-off-by: Myoungwon Oh --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 63d3bffe295e..793d57d93a23 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5786,6 +5786,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) case CEPH_OSD_OP_CACHE_PIN: case CEPH_OSD_OP_CACHE_UNPIN: case CEPH_OSD_OP_SET_REDIRECT: + case CEPH_OSD_OP_SET_CHUNK: case CEPH_OSD_OP_TIER_PROMOTE: case CEPH_OSD_OP_TIER_FLUSH: break; @@ -6123,7 +6124,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) if (result >= 0) { // mark that this is a cache eviction to avoid triggering normal // make_writeable() clone creation in finish_ctx() - ctx->cache_evict = true; + ctx->cache_operation = true; } osd->logger->inc(l_osd_tier_evict); } @@ -6983,10 +6984,9 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) result = -EOPNOTSUPP; break; } - if (ctx->snapc.snaps.size() || - (ctx->obc->ssc && ctx->obc->ssc->snapset.clones.size()) ) { - result = -EOPNOTSUPP; - break; + if (oi.manifest.is_redirect()) { + result = -EINVAL; + goto fail; } object_locator_t tgt_oloc; @@ -7067,6 +7067,7 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& ops) oi.manifest.chunk_map[src_offset].set_flag(chunk_info_t::FLAG_HAS_FINGERPRINT); } ctx->modify = true; + ctx->cache_operation = true; dout(10) << "set-chunked oid:" << oi.soid << " user_version: " << oi.user_version << " chunk_info: " << chunk_info << dendl; @@ -8224,7 +8225,7 @@ void PrimaryLogPG::make_writeable(OpContext *ctx) if ((ctx->obs->exists && !ctx->obs->oi.is_whiteout()) && // head exist(ed) snapc.snaps.size() && // there are snaps - !ctx->cache_evict && + !ctx->cache_operation && snapc.snaps[0] > ctx->new_snapset.seq) { // existing object is old // clone hobject_t coid = soid; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 84e503e98001..9e759ed5cff3 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -601,7 +601,7 @@ public: bool modify; // (force) modification (even if op_t is empty) bool user_modify; // user-visible modification bool undirty; // user explicitly un-dirtying this object - bool cache_evict; ///< true if this is a cache eviction + bool cache_operation; ///< true if this is a cache eviction bool ignore_cache; ///< true if IGNORE_CACHE flag is std::set bool ignore_log_op_stats; // don't log op stats bool update_log_only; ///< this is a write that returned an error - just record in pg log for dup detection @@ -708,7 +708,7 @@ public: obs(&obc->obs), snapset(0), new_obs(obs->oi, obs->exists), - modify(false), user_modify(false), undirty(false), cache_evict(false), + modify(false), user_modify(false), undirty(false), cache_operation(false), ignore_cache(false), ignore_log_op_stats(false), update_log_only(false), bytes_written(0), bytes_read(0), user_at_version(0), current_osd_subop_num(0), @@ -727,7 +727,7 @@ public: OpContext(OpRequestRef _op, osd_reqid_t _reqid, std::vector* _ops, PrimaryLogPG *_pg) : op(_op), reqid(_reqid), ops(_ops), obs(NULL), snapset(0), - modify(false), user_modify(false), undirty(false), cache_evict(false), + modify(false), user_modify(false), undirty(false), cache_operation(false), ignore_cache(false), ignore_log_op_stats(false), update_log_only(false), bytes_written(0), bytes_read(0), user_at_version(0), current_osd_subop_num(0),