]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: separate explicit pg target from current target
authorSage Weil <sage@inktank.com>
Sun, 6 Oct 2013 20:22:31 +0000 (13:22 -0700)
committerSage Weil <sage@inktank.com>
Fri, 6 Dec 2013 22:36:37 +0000 (14:36 -0800)
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 <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index f5dcd4b8ae541145402cdff3c6cc06432a7fa306..e7edff3b5357784775d053ccbd5e2c4bfdcc6972 100644 (file)
@@ -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,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<int> 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);
index 41973ddaf5ffab382897cdcc20f3864eb549a433..b07449ee2409ec94f185a88f8b4d25a0a7afcc42 100644 (file)
@@ -861,8 +861,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
@@ -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) {