summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-10-06 13:22:31 -0700
committerSage Weil <sage@inktank.com>2013-10-10 10:40:09 -0700
commitc1bd72d439409ec098821f0d21d09515356c4c29 (patch)
tree9ae1aee824c6c0cea3d6fe4c4ca522a5e512d506
parentd1956f3ce4444c5d4ac100aef71e1ecf025906f6 (diff)
downloadceph-c1bd72d439409ec098821f0d21d09515356c4c29.tar.gz
osdc/Objecter: explicitly 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 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 <sage@inktank.com>
-rw-r--r--src/osdc/Objecter.cc17
-rw-r--r--src/osdc/Objecter.h11
2 files changed, 17 insertions, 11 deletions
diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc
index d2c574d982e..bd1f2699136 100644
--- a/src/osdc/Objecter.cc
+++ b/src/osdc/Objecter.cc
@@ -1322,9 +1322,6 @@ bool Objecter::is_pg_changed(vector<int>& o, vector<int>& n, bool any_change)
int Objecter::recalc_op_target(Op *op)
{
- vector<int> 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,22 @@ 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;
}
+ op->pgid = pgid;
+ vector<int> acting;
osdmap->pg_to_acting_osds(pgid, acting);
if (op->pgid != pgid || is_pg_changed(op->acting, acting, op->used_replica)) {
@@ -1764,7 +1767,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 1196633276d..5f523b93afa 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -872,8 +872,11 @@ public:
object_t target_oid;
object_locator_t target_oloc;
- pg_t pgid;
- vector<int> 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<int> acting; ///< acting for last pg we mapped to
bool used_replica;
ConnectionRef con; // for rx buffer only
@@ -903,7 +906,6 @@ public:
utime_t stamp;
- bool precalc_pgid;
epoch_t map_dne_bound;
bool budgeted;
@@ -915,12 +917,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) {