]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: _calc_target - inline spgid 28570/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Sat, 15 Jun 2019 06:24:29 +0000 (14:24 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 15 Jun 2019 07:05:27 +0000 (15:05 +0800)
A follow-up of https://github.com/ceph/ceph/pull/28487.
For erasure pools this can save us an obviously redundant call
of do_crush and other things.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/osd_types.h
src/osdc/Objecter.cc

index f15f491db0217ccc74210b4ff6dcc4884eb4aade..26fcfd0174ea5c6cfedd77e0849039fec02bdd95 100644 (file)
@@ -539,6 +539,9 @@ struct spg_t {
   uint64_t pool() const {
     return pgid.pool();
   }
+  void reset_shard(shard_id_t s) {
+    shard = s;
+  }
 
   static const uint8_t calc_name_buf_size = pg_t::calc_name_buf_size + 4; // 36 + len('s') + len("255");
   char *calc_name(char *buf, const char *suffix_backwords) const;
index a0ba31e60a284c6997b1692bac2ac974594e52a8..6033f0366786328fc18c32eecb392916c9ca1542 100644 (file)
@@ -2943,9 +2943,16 @@ int Objecter::_calc_target(op_target_t *t, Connection *con, bool any_change)
     t->pg_num = pg_num;
     t->pg_num_mask = pg_num_mask;
     t->pg_num_pending = pg_num_pending;
-    osdmap->get_primary_shard(
-      pg_t(ceph_stable_mod(pgid.ps(), t->pg_num, t->pg_num_mask), pgid.pool()),
-      &t->actual_pgid);
+    spg_t spgid(actual_pgid);
+    if (pi->is_erasure()) {
+      for (uint8_t i = 0; i < acting.size(); ++i) {
+        if (acting[i] == acting_primary) {
+          spgid.reset_shard(shard_id_t(i));
+          break;
+        }
+      }
+    }
+    t->actual_pgid = spgid;
     t->sort_bitwise = sort_bitwise;
     t->recovery_deletes = recovery_deletes;
     ldout(cct, 10) << __func__ << " "