]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: use app.alien() to initialize AlienStore::alien
authorKefu Chai <kchai@redhat.com>
Sun, 18 Jul 2021 14:01:13 +0000 (22:01 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 18 Jul 2021 14:06:36 +0000 (22:06 +0800)
in e53ea0886fba9073904f59ea85fb73d854565921, the new alien::submit_to() API
is used in the place of the old one. but seastar::alien::instance::_qs
should be initialized before we are able to use the alien instance, just
creating an instance of alien::instance is not enough.

in this change, instead of creating an instance of alien::instance using
make_unique<>, the return value of app.alien() is used to initialize the
alien member variable of AlienStore. app.alien() is always properly
initialized by reactor.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/os/alienstore/alien_store.cc
src/crimson/os/alienstore/alien_store.h
src/crimson/os/futurized_store.cc
src/crimson/os/futurized_store.h
src/crimson/osd/main.cc
src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index f108cb9ee6b9b3808122b4459ce9ee0b403aa899..3d471feb1bdab1adbaffefdd75a17d4cef733edb 100644 (file)
@@ -64,9 +64,11 @@ namespace crimson::os {
 
 using crimson::common::get_conf;
 
-AlienStore::AlienStore(const std::string& path, const ConfigValues& values)
+AlienStore::AlienStore(const std::string& path,
+                       const ConfigValues& values,
+                       seastar::alien::instance& alien)
   : path{path},
-    alien{std::make_unique<seastar::alien::instance>()}
+    alien{alien}
 {
   cct = std::make_unique<CephContext>(CEPH_ENTITY_TYPE_OSD);
   g_ceph_context = cct.get();
@@ -420,7 +422,7 @@ seastar::future<> AlienStore::do_transaction(CollectionRef ch,
          assert(tp);
          return tp->submit(ch->get_cid().hash_to_shard(tp->size()),
            [this, ch, id, crimson_wrapper, &txn, &done] {
-           txn.register_on_commit(new OnCommit(*alien,
+           txn.register_on_commit(new OnCommit(alien,
                                                id, done, crimson_wrapper,
                                                txn));
            auto c = static_cast<AlienCollection*>(ch.get());
index 940177b63c1ba6043835c8371daf7e32b79b6f24..d9b9b3bcda6deec2227d87a1ffc3d5e459d75dba 100644 (file)
@@ -43,7 +43,9 @@ public:
     AlienStore* store;
     CollectionRef ch;
   };
-  AlienStore(const std::string& path, const ConfigValues& values);
+  AlienStore(const std::string& path,
+             const ConfigValues& values,
+             seastar::alien::instance& alien);
   ~AlienStore() final;
 
   seastar::future<> start() final;
@@ -127,7 +129,7 @@ private:
   constexpr static unsigned MAX_KEYS_PER_OMAP_GET_CALL = 32;
   mutable std::unique_ptr<crimson::os::ThreadPool> tp;
   const std::string path;
-  std::unique_ptr<seastar::alien::instance> alien;
+  seastar::alien::instance& alien;
   uint64_t used_bytes = 0;
   std::unique_ptr<ObjectStore> store;
   std::unique_ptr<CephContext> cct;
index 3b594fb49694f15a5c5c7963afa8ca650aae6a2e..e13052de57abefe03d9bfa990b6dc282a5669d34 100644 (file)
@@ -8,12 +8,13 @@ namespace crimson::os {
 std::unique_ptr<FuturizedStore>
 FuturizedStore::create(const std::string& type,
                        const std::string& data,
-                       const ConfigValues& values)
+                       const ConfigValues& values,
+                       seastar::alien::instance& alien)
 {
   if (type == "memstore") {
     return std::make_unique<crimson::os::CyanStore>(data);
   } else if (type == "bluestore") {
-    return std::make_unique<crimson::os::AlienStore>(data, values);
+    return std::make_unique<crimson::os::AlienStore>(data, values, alien);
   } else if (type == "seastore") {
     return crimson::os::seastore::make_seastore(data, values);
   } else {
index 435b11067f4daf7bd89c295782ca659d8b4d121c..84ab35155e64ca734a5bde8755ebc9c83ac27d17 100644 (file)
 #include "include/uuid.h"
 #include "osd/osd_types.h"
 
+namespace seastar::alien {
+class instance;
+}
+
 namespace ceph::os {
 class Transaction;
 }
@@ -53,7 +57,8 @@ public:
 
   static std::unique_ptr<FuturizedStore> create(const std::string& type,
                                                 const std::string& data,
-                                                const ConfigValues& values);
+                                                const ConfigValues& values,
+                                                seastar::alien::instance& alien);
   FuturizedStore() = default;
   virtual ~FuturizedStore() = default;
 
index 123dd45df6aa60af5cba35f44562a5042a618446..b5ff8570a067b390cb721eb3a0eb0a4fa102e6ff 100644 (file)
@@ -285,6 +285,7 @@ int main(int argc, char* argv[])
             configure_crc_handling(*msgr);
           }
           osd.start_single(whoami, nonce,
+                           std::ref(app.alien()),
                            cluster_msgr, client_msgr,
                            hb_front_msgr, hb_back_msgr).get();
           auto stop_osd = seastar::defer([&] {
index 4374388bfa644b923d501f806b3e429ae7861891..b96b3af083c671e74ebcb850b8efe0638f93285b 100644 (file)
@@ -70,6 +70,7 @@ using crimson::os::FuturizedStore;
 namespace crimson::osd {
 
 OSD::OSD(int id, uint32_t nonce,
+         seastar::alien::instance& alien,
          crimson::net::MessengerRef cluster_msgr,
          crimson::net::MessengerRef public_msgr,
          crimson::net::MessengerRef hb_front_msgr,
@@ -85,7 +86,8 @@ OSD::OSD(int id, uint32_t nonce,
     store{crimson::os::FuturizedStore::create(
       local_conf().get_val<std::string>("osd_objectstore"),
       local_conf().get_val<std::string>("osd_data"),
-      local_conf().get_config_values())},
+      local_conf().get_config_values(),
+      alien)},
     shard_services{*this, whoami, *cluster_msgr, *public_msgr, *monc, *mgrc, *store},
     heartbeat{new Heartbeat{whoami, shard_services, *monc, hb_front_msgr, hb_back_msgr}},
     // do this in background
index 600c953dcca694742dde0338412aabb5ca83ec51..6d29282d0756a92e208295e49eaf842ec104aa37 100644 (file)
@@ -40,6 +40,10 @@ class OSDMap;
 class OSDMeta;
 class Heartbeat;
 
+namespace seastar::alien {
+  class instance;
+}
+
 namespace ceph::os {
   class Transaction;
 }
@@ -121,6 +125,7 @@ class OSD final : public crimson::net::Dispatcher,
 
 public:
   OSD(int id, uint32_t nonce,
+      seastar::alien::instance& alien,
       crimson::net::MessengerRef cluster_msgr,
       crimson::net::MessengerRef client_msgr,
       crimson::net::MessengerRef hb_front_msgr,