From: Kefu Chai Date: Sun, 18 Jul 2021 14:01:13 +0000 (+0800) Subject: crimson/osd: use app.alien() to initialize AlienStore::alien X-Git-Tag: v17.1.0~1364^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8fad523d41008727c9a952afcda15b77be50ba3c;p=ceph-ci.git crimson/osd: use app.alien() to initialize AlienStore::alien 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 --- diff --git a/src/crimson/os/alienstore/alien_store.cc b/src/crimson/os/alienstore/alien_store.cc index f108cb9ee6b..3d471feb1bd 100644 --- a/src/crimson/os/alienstore/alien_store.cc +++ b/src/crimson/os/alienstore/alien_store.cc @@ -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()} + alien{alien} { cct = std::make_unique(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(ch.get()); diff --git a/src/crimson/os/alienstore/alien_store.h b/src/crimson/os/alienstore/alien_store.h index 940177b63c1..d9b9b3bcda6 100644 --- a/src/crimson/os/alienstore/alien_store.h +++ b/src/crimson/os/alienstore/alien_store.h @@ -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 tp; const std::string path; - std::unique_ptr alien; + seastar::alien::instance& alien; uint64_t used_bytes = 0; std::unique_ptr store; std::unique_ptr cct; diff --git a/src/crimson/os/futurized_store.cc b/src/crimson/os/futurized_store.cc index 3b594fb4969..e13052de57a 100644 --- a/src/crimson/os/futurized_store.cc +++ b/src/crimson/os/futurized_store.cc @@ -8,12 +8,13 @@ namespace crimson::os { std::unique_ptr 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(data); } else if (type == "bluestore") { - return std::make_unique(data, values); + return std::make_unique(data, values, alien); } else if (type == "seastore") { return crimson::os::seastore::make_seastore(data, values); } else { diff --git a/src/crimson/os/futurized_store.h b/src/crimson/os/futurized_store.h index 435b11067f4..84ab35155e6 100644 --- a/src/crimson/os/futurized_store.h +++ b/src/crimson/os/futurized_store.h @@ -15,6 +15,10 @@ #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 create(const std::string& type, const std::string& data, - const ConfigValues& values); + const ConfigValues& values, + seastar::alien::instance& alien); FuturizedStore() = default; virtual ~FuturizedStore() = default; diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 123dd45df6a..b5ff8570a06 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -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([&] { diff --git a/src/crimson/osd/osd.cc b/src/crimson/osd/osd.cc index 4374388bfa6..b96b3af083c 100644 --- a/src/crimson/osd/osd.cc +++ b/src/crimson/osd/osd.cc @@ -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("osd_objectstore"), local_conf().get_val("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 diff --git a/src/crimson/osd/osd.h b/src/crimson/osd/osd.h index 600c953dcca..6d29282d075 100644 --- a/src/crimson/osd/osd.h +++ b/src/crimson/osd/osd.h @@ -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,