From dd8c9398412afe264afcaefc901d65d99b9066d7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 6 Oct 2013 13:22:31 -0700 Subject: [PATCH] osdc/Objecter: separate explicit pg target from current target The pgid field is used to store the pg the op mapped to. We were just setting it directly for PGLS. Instead, fill in a new base_pgid, and copy that to pgid in recalc_op_target(), the same way we do when we map an object name to a PG. In particular, we take this opportunity to map a raw pgid to an actual pgid. This means the base_pg could come from a raw hash value (although it doesn't, yet). Signed-off-by: Sage Weil Signed-off-by: Greg Farnum --- src/osdc/Objecter.cc | 16 +++++++++------- src/osdc/Objecter.h | 11 +++++++---- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index f5dcd4b8ae541..e7edff3b53577 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -1322,9 +1322,6 @@ bool Objecter::is_pg_changed(vector& o, vector& n, bool any_change) int Objecter::recalc_op_target(Op *op) { - vector acting; - pg_t pgid = op->pgid; - bool is_read = op->flags & CEPH_OSD_FLAG_READ; bool is_write = op->flags & CEPH_OSD_FLAG_WRITE; @@ -1348,16 +1345,21 @@ int Objecter::recalc_op_target(Op *op) } } + pg_t pgid; if (op->precalc_pgid) { assert(op->base_oid.name.empty()); // make sure this is a listing op - ldout(cct, 10) << "recalc_op_target have " << pgid << " pool " << osdmap->have_pg_pool(pgid.pool()) << dendl; - if (!osdmap->have_pg_pool(pgid.pool())) + ldout(cct, 10) << "recalc_op_target have " << op->base_pgid << " pool " + << osdmap->have_pg_pool(op->base_pgid.pool()) << dendl; + if (!osdmap->have_pg_pool(op->base_pgid.pool())) return RECALC_OP_TARGET_POOL_DNE; + pgid = osdmap->raw_pg_to_pg(op->base_pgid); } else { - int ret = osdmap->object_locator_to_pg(op->target_oid, op->target_oloc, pgid); + int ret = osdmap->object_locator_to_pg(op->target_oid, op->target_oloc, + pgid); if (ret == -ENOENT) return RECALC_OP_TARGET_POOL_DNE; } + vector acting; osdmap->pg_to_acting_osds(pgid, acting); if (op->pgid != pgid || is_pg_changed(op->acting, acting, op->used_replica)) { @@ -1764,7 +1766,7 @@ void Objecter::list_objects(ListContext *list_context, Context *onfinish) { o->outbl = bl; o->reply_epoch = &onack->epoch; - o->pgid = pg_t(list_context->current_pg, list_context->pool_id, -1); + o->base_pgid = pg_t(list_context->current_pg, list_context->pool_id, -1); o->precalc_pgid = true; op_submit(o); diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 41973ddaf5ffa..b07449ee2409e 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -861,8 +861,11 @@ public: object_t target_oid; object_locator_t target_oloc; - pg_t pgid; - vector acting; + bool precalc_pgid; ///< true if we are directed at base_pgid, not base_oid + pg_t base_pgid; ///< explciti pg target, if any + + pg_t pgid; ///< last pg we mapped to + vector acting; ///< acting for last pg we mapped to bool used_replica; ConnectionRef con; // for rx buffer only @@ -892,7 +895,6 @@ public: utime_t stamp; - bool precalc_pgid; epoch_t map_dne_bound; bool budgeted; @@ -904,12 +906,13 @@ public: int f, Context *ac, Context *co, version_t *ov) : session(NULL), session_item(this), incarnation(0), base_oid(o), base_oloc(ol), + precalc_pgid(false), used_replica(false), con(NULL), snapid(CEPH_NOSNAP), outbl(NULL), flags(f), priority(0), onack(ac), oncommit(co), tid(0), attempts(0), - paused(false), objver(ov), reply_epoch(NULL), precalc_pgid(false), + paused(false), objver(ov), reply_epoch(NULL), map_dne_bound(0), budgeted(false), should_resend(true) { -- 2.39.5