]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore: implement FuturizedStore::flush
authorSamuel Just <sjust@redhat.com>
Fri, 14 Jan 2022 06:53:17 +0000 (06:53 +0000)
committerSamuel Just <sjust@redhat.com>
Mon, 17 Jan 2022 20:50:58 +0000 (20:50 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/journal.cc
src/crimson/os/seastore/journal.h
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/seastore.h
src/crimson/os/seastore/transaction_manager.cc
src/crimson/os/seastore/transaction_manager.h

index c1fc6e5d89164cb757ed7eafd6548a032c6d7972..8e25cb58cf60ae51f5143bb7b633a59c57783937 100644 (file)
@@ -605,6 +605,14 @@ Journal::RecordSubmitter::submit(
   return do_submit(std::move(record), handle);
 }
 
+seastar::future<> Journal::RecordSubmitter::flush(OrderingHandle &handle)
+{
+  return handle.enter(write_pipeline->device_submission
+  ).then([this, &handle] {
+    return handle.enter(write_pipeline->finalize);
+  });
+}
+
 void Journal::RecordSubmitter::update_state()
 {
   if (num_outstanding_io == 0) {
index d6f18cceab296eb8754004e4eb4de95fa6447ad6..75666f0573a88deb70fc7ec50d3b2572c13e44d0 100644 (file)
@@ -99,6 +99,17 @@ public:
     return record_submitter.submit(std::move(record), handle);
   }
 
+  /**
+   * flush
+   *
+   * Wait for all outstanding IOs on handle to commit.
+   * Note, flush() machinery must go through the same pipeline
+   * stages and locks as submit_record.
+   */
+  seastar::future<> flush(OrderingHandle &handle) {
+    return record_submitter.flush(handle);
+  }
+
   /**
    * Read deltas and pass to delta_handler
    *
@@ -392,6 +403,7 @@ private:
 
     using submit_ret = Journal::submit_record_ret;
     submit_ret submit(record_t&&, OrderingHandle&);
+    seastar::future<> flush(OrderingHandle &handle);
 
   private:
     void update_state();
index eb166b1ad3258ee005eb6049774c099b2774cfed..1a89fa79a44a40bc3c946b43290812ca36956f0c 100644 (file)
@@ -925,6 +925,20 @@ seastar::future<> SeaStore::do_transaction(
     });
 }
 
+
+seastar::future<> SeaStore::flush(CollectionRef ch)
+{
+  return seastar::do_with(
+    get_dummy_ordering_handle(),
+    [this, ch](auto &handle) {
+      return handle.take_collection_lock(
+       static_cast<SeastoreCollection&>(*ch).ordering_lock
+      ).then([this, &handle] {
+       return transaction_manager->flush(handle);
+      });
+    });
+}
+
 SeaStore::tm_ret SeaStore::_do_transaction_step(
   internal_context_t &ctx,
   CollectionRef &col,
index d1c325432d7ff93b485f47e2611586d6c6e31f6d..93e34c28801e3898d4ac64a71c85ce5cf6b6e1a1 100644 (file)
@@ -139,6 +139,10 @@ public:
     CollectionRef ch,
     ceph::os::Transaction&& txn) final;
 
+  /* Note, flush() machinery must go through the same pipeline
+   * stages and locks as do_transaction. */
+  seastar::future<> flush(CollectionRef ch) final;
+
   seastar::future<OmapIteratorRef> get_omap_iterator(
     CollectionRef ch,
     const ghobject_t& oid) final;
index 624ae4c0d5fd5ecfc1b247c3e37b91542798a876..c9dc00e4ead72d7089a14ce960438e5f5cf35c12 100644 (file)
@@ -321,6 +321,19 @@ TransactionManager::submit_transaction_direct(
   });
 }
 
+seastar::future<> TransactionManager::flush(OrderingHandle &handle)
+{
+  return handle.enter(write_pipeline.reserve_projected_usage
+  ).then([this, &handle] {
+    return handle.enter(write_pipeline.ool_writes);
+  }).then([this, &handle] {
+    return handle.enter(write_pipeline.prepare);
+  }).then([this, &handle] {
+    handle.maybe_release_collection_lock();
+    return journal->flush(handle);
+  });
+}
+
 TransactionManager::get_next_dirty_extents_ret
 TransactionManager::get_next_dirty_extents(
   Transaction &t,
index cb3cdec8d19d438e9334e47dd1fbb1d58f304080..82c825c284ca623314bb49289af37328cac0c098 100644 (file)
@@ -374,6 +374,15 @@ public:
   submit_transaction_direct_ret submit_transaction_direct(
     Transaction &t) final;
 
+  /**
+   * flush
+   *
+   * Block until all outstanding IOs on handle are committed.
+   * Note, flush() machinery must go through the same pipeline
+   * stages and locks as submit_transaction.
+   */
+  seastar::future<> flush(OrderingHandle &handle);
+
   using SegmentCleaner::ExtentCallbackInterface::get_next_dirty_extents_ret;
   get_next_dirty_extents_ret get_next_dirty_extents(
     Transaction &t,