]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Add tracking of acting_features and upacting_features
authorDavid Zafman <dzafman@redhat.com>
Thu, 4 Jun 2015 23:15:29 +0000 (16:15 -0700)
committerDavid Zafman <dzafman@redhat.com>
Fri, 19 Jun 2015 21:09:09 +0000 (14:09 -0700)
Use most appropriate feature intersection depending on context

Signed-off-by: David Zafman <dzafman@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index bf8dcdfeeff9e1dd643e2279c6b4e50a24b7e48b..e0bad7889882ce5f7d39747c34150be149fe4efb 100644 (file)
@@ -217,7 +217,9 @@ PG::PG(OSDService *o, OSDMapRef curmap,
   active_pushes(0),
   recovery_state(this),
   pg_id(p),
-  peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT)
+  peer_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
+  acting_features(CEPH_FEATURES_SUPPORTED_DEFAULT),
+  upacting_features(CEPH_FEATURES_SUPPORTED_DEFAULT)
 {
 #ifdef PG_DEBUG_REFS
   osd->add_pgid(p, this);
@@ -4000,7 +4002,7 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
          osd->clog->info(oss);
        }
 
-       if (peer_features & CEPH_FEATURE_OSD_OBJECT_DIGEST)
+       if (get_min_acting_features() & CEPH_FEATURE_OSD_OBJECT_DIGEST)
          scrubber.seed = -1; // better, and enables oi digest checks
        else
          scrubber.seed = 0;  // compat
@@ -4249,7 +4251,7 @@ void PG::scrub_compare_maps()
     }
 
     // can we relate scrub digests to oi digests?
-    bool okseed = (get_min_peer_features() & CEPH_FEATURE_OSD_OBJECT_DIGEST);
+    bool okseed = (get_min_upacting_features() & CEPH_FEATURE_OSD_OBJECT_DIGEST);
     assert(okseed == (scrubber.seed == 0xffffffff));
 
     get_pgbackend()->be_compare_scrubmaps(
@@ -6905,7 +6907,7 @@ PG::RecoveryState::GetInfo::GetInfo(my_context ctx)
   if (!prior_set.get())
     pg->build_prior(prior_set);
 
-  pg->reset_peer_features();
+  pg->reset_all_min_features();
   get_infos();
   if (peer_info_requested.empty() && !prior_set->pg_down) {
     post_event(GotInfo());
@@ -6981,10 +6983,22 @@ boost::statechart::result PG::RecoveryState::GetInfo::react(const MNotifyRec& in
       }
       get_infos();
     }
-    dout(20) << "Adding osd: " << infoevt.from.osd << " features: "
+    dout(20) << "Adding osd: " << infoevt.from.osd << " peer features: "
       << hex << infoevt.features << dec << dendl;
     pg->apply_peer_features(infoevt.features);
 
+    if (std::find(pg->acting.begin(), pg->acting.end(), infoevt.from.osd) != pg->acting.end()) {
+      dout(20) << "Adding osd: " << infoevt.from.osd << " acting features: "
+       << hex << infoevt.features << dec << dendl;
+      pg->apply_acting_features(infoevt.features);
+    }
+
+    if (std::find(pg->up.begin(), pg->up.end(), infoevt.from.osd) != pg->up.end()) {
+      dout(20) << "Adding osd: " << infoevt.from.osd << " upacting features: "
+       << hex << infoevt.features << dec << dendl;
+      pg->apply_upacting_features(infoevt.features);
+    }
+
     // are we done getting everything?
     if (peer_info_requested.empty() && !prior_set->pg_down) {
       /*
@@ -7042,7 +7056,9 @@ boost::statechart::result PG::RecoveryState::GetInfo::react(const MNotifyRec& in
          break;
        }
       }
-      dout(20) << "Common features: " << hex << pg->get_min_peer_features() << dec << dendl;
+      dout(20) << "Common peer features: " << hex << pg->get_min_peer_features() << dec << dendl;
+      dout(20) << "Common acting features: " << hex << pg->get_min_acting_features() << dec << dendl;
+      dout(20) << "Common upacting features: " << hex << pg->get_min_upacting_features() << dec << dendl;
       post_event(GotInfo());
     }
   }
index a6af4969fb6a8f376bed1ac445875d10eab6f90d..f2ac76a16f0e3bcfe3a1c9eeb8fa8aca7cfa412e 100644 (file)
@@ -2012,14 +2012,24 @@ public:
   PG& operator=(const PG& rhs);
   const spg_t pg_id;
   uint64_t peer_features;
+  uint64_t acting_features;
+  uint64_t upacting_features;
 
  public:
   const spg_t&      get_pgid() const { return pg_id; }
   int        get_nrep() const { return acting.size(); }
 
-  void reset_peer_features() { peer_features = CEPH_FEATURES_SUPPORTED_DEFAULT; }
+  void reset_all_min_features() {
+     peer_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
+     acting_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
+     upacting_features = CEPH_FEATURES_SUPPORTED_DEFAULT;
+  }
   uint64_t get_min_peer_features() const { return peer_features; }
+  uint64_t get_min_acting_features() const { return acting_features; }
+  uint64_t get_min_upacting_features() const { return upacting_features; }
   void apply_peer_features(uint64_t f) { peer_features &= f; }
+  void apply_acting_features(uint64_t f) { acting_features &= f; }
+  void apply_upacting_features(uint64_t f) { upacting_features &= f; }
 
   void init_primary_up_acting(
     const vector<int> &newup,
index c5f39b817e06835b9b00eaf9ece7fa0b2949b974..fa951167711e4276f92f4f42cadd08b1b6ad324b 100644 (file)
@@ -4118,7 +4118,7 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
       ++ctx->num_write;
       {
        tracepoint(osd, do_osd_op_pre_setallochint, soid.oid.name.c_str(), soid.snap.val, op.alloc_hint.expected_object_size, op.alloc_hint.expected_write_size);
-        if (!(get_min_peer_features() & CEPH_FEATURE_OSD_SET_ALLOC_HINT)) { 
+        if (!(get_min_upacting_features() & CEPH_FEATURE_OSD_SET_ALLOC_HINT)) { 
           result = -EOPNOTSUPP;
           break;
         }
index 5bc36e49bac35fe790fd07546c34bb12c8b318ed..9e23023593796acc3a89a44dcb660f48572f7950 100644 (file)
@@ -452,7 +452,7 @@ public:
   }
 
   bool transaction_use_tbl() {
-    uint64_t min_features = get_min_peer_features();
+    uint64_t min_features = get_min_upacting_features();
     return !(min_features & CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT);
   }