]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: adapt to the new alien API 41881/head
authorKefu Chai <kchai@redhat.com>
Wed, 16 Jun 2021 09:11:50 +0000 (17:11 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 16 Jun 2021 09:14:40 +0000 (17:14 +0800)
since seastar now deprecates the old alien::submit_to() API, and
replaced it with a variant which requires a new parameter of "alien"
instance, let's pick it up, to amortize the cost to catch up with
the seastar master HEAD.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/os/alienstore/alien_store.cc
src/crimson/os/alienstore/alien_store.h
src/seastar
src/test/crimson/seastar_runner.h
src/test/crimson/test_alien_echo.cc

index 4f6eb4b8665cf3a70f4bed91c648cc9be53daee2..b99d84d0e4054841e9137ab3e862e2e8ac5392c2 100644 (file)
@@ -33,20 +33,22 @@ namespace {
 
 class OnCommit final: public Context
 {
-  int cpuid;
+  seastar::alien::instance& alien;
+  const int cpuid;
   Context *oncommit;
   seastar::promise<> &alien_done;
 public:
   OnCommit(
+    seastar::alien::instance& alien,
     int id,
     seastar::promise<> &done,
     Context *oncommit,
     ceph::os::Transaction& txn)
-    : cpuid(id), oncommit(oncommit),
+    : alien(alien), cpuid(id), oncommit(oncommit),
       alien_done(done) {}
 
   void finish(int) final {
-    return seastar::alien::submit_to(cpuid, [this] {
+    return seastar::alien::submit_to(alien, cpuid, [this] {
       if (oncommit) {
         oncommit->complete(0);
       }
@@ -62,7 +64,8 @@ namespace crimson::os {
 using crimson::common::get_conf;
 
 AlienStore::AlienStore(const std::string& path, const ConfigValues& values)
-  : path{path}
+  : path{path},
+    alien{std::make_unique<seastar::alien::instance>()}
 {
   cct = std::make_unique<CephContext>(CEPH_ENTITY_TYPE_OSD);
   g_ceph_context = cct.get();
@@ -416,7 +419,9 @@ 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(id, done, crimson_wrapper, txn));
+           txn.register_on_commit(new OnCommit(*alien,
+                                               id, done, crimson_wrapper,
+                                               txn));
            auto c = static_cast<AlienCollection*>(ch.get());
            return store->queue_transaction(c->collection, std::move(txn));
          });
index e6e474ebcffdda7252e2ec9558267debd1cc5e47..940177b63c1ba6043835c8371daf7e32b79b6f24 100644 (file)
 #include "crimson/os/futurized_collection.h"
 #include "crimson/os/futurized_store.h"
 
+namespace seastar::alien {
+class instance;
+}
+
 namespace ceph::os {
 class Transaction;
 }
@@ -123,6 +127,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;
   uint64_t used_bytes = 0;
   std::unique_ptr<ObjectStore> store;
   std::unique_ptr<CephContext> cct;
index 27b15a1972f08df8cdd2e939f39da5461bd8825e..2e3c6da3f8c8b69cb790b056661717f1d7346a61 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 27b15a1972f08df8cdd2e939f39da5461bd8825e
+Subproject commit 2e3c6da3f8c8b69cb790b056661717f1d7346a61
index 5a430554e59f4858198d0d31dfe0b301a9f4c894..ab140fa99cab7d077aea47b5e441e7f93915962c 100644 (file)
@@ -63,7 +63,8 @@ struct SeastarRunner {
 
   template <typename Func>
   void run(Func &&func) {
-    auto fut = seastar::alien::submit_to(0, std::forward<Func>(func));
+    auto fut = seastar::alien::submit_to(app.alien(), 0,
+                                        std::forward<Func>(func));
     fut.get();
   }
 };
index 4434b522be2d29a0f005212f8e56bce6ecafb27e..176f92fa100e0a5df2dab84eb8c1b50055c25388 100644 (file)
@@ -281,7 +281,7 @@ int main(int argc, char** argv)
   seastar::app_template app;
   SeastarContext sc;
   auto job = sc.with_seastar([&] {
-    auto fut = seastar::alien::submit_to(0, [addr, role, count] {
+    auto fut = seastar::alien::submit_to(app.alien(), 0, [addr, role, count] {
       return seastar_echo(addr, role, count);
     });
     fut.wait();