From b7fb6b3236eaa48e8c578544d2439943af2b1fa5 Mon Sep 17 00:00:00 2001 From: myoungwon oh Date: Sun, 28 Feb 2021 22:48:16 +0900 Subject: [PATCH] osd: clean-ups It is more easier to undertand if PromoteCallback is only used in promote_object, and PromoteManifestCallback is used in TIER_PROMOTE Signed-off-by: Myoungwon Oh --- src/osd/PrimaryLogPG.cc | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index d1f924d063b..949461de687 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3882,7 +3882,11 @@ public: void finish(PrimaryLogPG::CopyCallbackResults results) override { PrimaryLogPG::CopyResults *results_data = results.get<1>(); int r = results.get<0>(); - pg->finish_promote(r, results_data, obc); + if (obc->obs.oi.has_manifest() && obc->obs.oi.manifest.is_chunked()) { + pg->finish_promote_manifest(r, results_data, obc); + } else { + pg->finish_promote(r, results_data, obc); + } pg->osd->logger->tinc(l_osd_tier_promote_lat, ceph_clock_now() - start); } }; @@ -3894,7 +3898,7 @@ class PromoteManifestCallback: public PrimaryLogPG::CopyCallback { PrimaryLogPG::OpContext *ctx; PrimaryLogPG::CopyCallbackResults promote_results; public: - PromoteManifestCallback(ObjectContextRef obc_, PrimaryLogPG *pg_, PrimaryLogPG::OpContext *ctx = NULL) + PromoteManifestCallback(ObjectContextRef obc_, PrimaryLogPG *pg_, PrimaryLogPG::OpContext *ctx) : obc(obc_), pg(pg_), start(ceph_clock_now()), ctx(ctx) {} @@ -3902,25 +3906,21 @@ public: void finish(PrimaryLogPG::CopyCallbackResults results) override { PrimaryLogPG::CopyResults *results_data = results.get<1>(); int r = results.get<0>(); - if (ctx) { - promote_results = results; - if (obc->obs.oi.has_manifest() && obc->obs.oi.manifest.is_redirect()) { - ctx->user_at_version = results_data->user_version; - } - if (r >= 0) { - ctx->pg->execute_ctx(ctx); - } else { - if (r != -ECANCELED) { - if (ctx->op) - ctx->pg->osd->reply_op_error(ctx->op, r); - } else if (results_data->should_requeue) { - if (ctx->op) - ctx->pg->requeue_op(ctx->op); - } - ctx->pg->close_op_ctx(ctx); - } + promote_results = results; + if (obc->obs.oi.has_manifest() && obc->obs.oi.manifest.is_redirect()) { + ctx->user_at_version = results_data->user_version; + } + if (r >= 0) { + ctx->pg->execute_ctx(ctx); } else { - pg->finish_promote_manifest(r, results_data, obc); + if (r != -ECANCELED) { + if (ctx->op) + ctx->pg->osd->reply_op_error(ctx->op, r); + } else if (results_data->should_requeue) { + if (ctx->op) + ctx->pg->requeue_op(ctx->op); + } + ctx->pg->close_op_ctx(ctx); } pg->osd->logger->tinc(l_osd_tier_promote_lat, ceph_clock_now() - start); } @@ -4003,7 +4003,7 @@ void PrimaryLogPG::promote_object(ObjectContextRef obc, } else { if (obc->obs.oi.manifest.is_chunked()) { src_hoid = obc->obs.oi.soid; - cb = new PromoteManifestCallback(obc, this); + cb = new PromoteCallback(obc, this); } else if (obc->obs.oi.manifest.is_redirect()) { object_locator_t src_oloc(obc->obs.oi.manifest.redirect_target); my_oloc = src_oloc; -- 2.39.5