]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/seastore: make fiemap return errorator future
authorchunmei-liu <chunmei.liu@intel.com>
Sat, 19 Feb 2022 18:56:15 +0000 (10:56 -0800)
committerchunmei-liu <chunmei.liu@intel.com>
Wed, 2 Mar 2022 22:39:49 +0000 (14:39 -0800)
Signed-off-by: chunmei-liu <chunmei.liu@intel.com>
src/crimson/os/alienstore/alien_store.cc
src/crimson/os/alienstore/alien_store.h
src/crimson/os/cyanstore/cyan_store.cc
src/crimson/os/cyanstore/cyan_store.h
src/crimson/os/futurized_store.h
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/seastore.h
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h
src/crimson/osd/replicated_recovery_backend.cc
src/test/crimson/seastore/test_seastore.cc

index 904540a4c44ae512e1cd7e0f4733f587268a8307..5035b2da14c0ec0b7c25c44edff068dc23d60bf6 100644 (file)
@@ -575,7 +575,7 @@ auto AlienStore::omap_get_header(CollectionRef ch,
   });
 }
 
-seastar::future<std::map<uint64_t, uint64_t>> AlienStore::fiemap(
+AlienStore::read_errorator::future<std::map<uint64_t, uint64_t>> AlienStore::fiemap(
   CollectionRef ch,
   const ghobject_t& oid,
   uint64_t off,
@@ -586,9 +586,9 @@ seastar::future<std::map<uint64_t, uint64_t>> AlienStore::fiemap(
     return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, &destmap] {
       auto c = static_cast<AlienCollection*>(ch.get());
       return store->fiemap(c->collection, oid, off, len, destmap);
-    }).then([&destmap] (int i) {
-      return seastar::make_ready_future<std::map<uint64_t, uint64_t>>(
-       std::move(destmap));
+    }).then([&destmap](int i) {
+      return read_errorator::make_ready_future<std::map<uint64_t, uint64_t>>(
+        std::move(destmap));
     });
   });
 }
index 7a3db432f87b6caa9e10051e65f34b803315f1d5..b7927f50c91a538856d8e2e4bc0d1ecce6c3c0c1 100644 (file)
@@ -109,7 +109,7 @@ public:
   read_errorator::future<ceph::bufferlist> omap_get_header(
     CollectionRef,
     const ghobject_t&) final;
-  seastar::future<std::map<uint64_t, uint64_t>> fiemap(
+  read_errorator::future<std::map<uint64_t, uint64_t>> fiemap(
     CollectionRef,
     const ghobject_t&,
     uint64_t off,
index 9122a56c0b005f75c9d7e61f1ba09de34b57cb6a..f10be4ad1b7baa588b9080990bf08ebe0c71510c 100644 (file)
@@ -831,7 +831,7 @@ seastar::future<FuturizedStore::OmapIteratorRef> CyanStore::get_omap_iterator(
            new CyanStore::CyanOmapIterator(o));
 }
 
-seastar::future<std::map<uint64_t, uint64_t>>
+CyanStore::read_errorator::future<std::map<uint64_t, uint64_t>>
 CyanStore::fiemap(
     CollectionRef ch,
     const ghobject_t& oid,
index 492801e5a13beaf05414929bf8ce660cff051156..66ef00b25a2ad46f05987faef878383fd25cc92b 100644 (file)
@@ -137,7 +137,7 @@ public:
     CollectionRef c,
     const ghobject_t& oid);
 
-  seastar::future<std::map<uint64_t, uint64_t>> fiemap(CollectionRef c,
+  read_errorator::future<std::map<uint64_t, uint64_t>> fiemap(CollectionRef c,
                                                       const ghobject_t& oid,
                                                       uint64_t off,
                                                       uint64_t len);
index c35cba9b05d8bec734d199ea7a8be2c7ffe7bf51..eff6cb5e5d977e29afae0c161e3f08def899f1fc 100644 (file)
@@ -158,7 +158,7 @@ public:
   virtual seastar::future<OmapIteratorRef> get_omap_iterator(
     CollectionRef ch,
     const ghobject_t& oid) = 0;
-  virtual seastar::future<std::map<uint64_t, uint64_t>> fiemap(
+  virtual read_errorator::future<std::map<uint64_t, uint64_t>> fiemap(
     CollectionRef ch,
     const ghobject_t& oid,
     uint64_t off,
index 844a2e1ba059da1393d905c63294d5ca6f02355f..dde849a0af090b5bfc3ca2f47892555bac93e8df 100644 (file)
@@ -931,7 +931,8 @@ SeaStore::_fiemap_ret SeaStore::_fiemap(
       len);
   });
 }
-seastar::future<std::map<uint64_t, uint64_t>> SeaStore::fiemap(
+
+SeaStore::read_errorator::future<std::map<uint64_t, uint64_t>> SeaStore::fiemap(
   CollectionRef ch,
   const ghobject_t& oid,
   uint64_t off,
@@ -955,9 +956,6 @@ seastar::future<std::map<uint64_t, uint64_t>> SeaStore::fiemap(
       size - off:
       std::min(size - off, len);
     return _fiemap(t, onode, off, adjust_len);
-  }).handle_error(
-    crimson::ct_error::assert_all{
-      "Invalid error in SeaStore::fiemap"
   });
 }
 
index 29e78a6f2af07456bae7f6d83ac449c9bd2b6d06..5be931cb8ec47a41539b06fa5e31dc53675c1ffb 100644 (file)
@@ -148,7 +148,7 @@ public:
   seastar::future<OmapIteratorRef> get_omap_iterator(
     CollectionRef ch,
     const ghobject_t& oid) final;
-  seastar::future<std::map<uint64_t, uint64_t>> fiemap(
+  read_errorator::future<std::map<uint64_t, uint64_t>> fiemap(
     CollectionRef ch,
     const ghobject_t& oid,
     uint64_t off,
index e45b935bb323f2adf837f5091440839a9f4494f0..627c0eb23b7f82d7d13317d3498306df08b71b1e 100644 (file)
@@ -236,7 +236,7 @@ PGBackend::sparse_read(const ObjectState& os, OSDOp& osd_op,
                  os.oi.soid, op.extent.offset, op.extent.length);
   return interruptor::make_interruptible(store->fiemap(coll, ghobject_t{os.oi.soid},
                       op.extent.offset,
-                      op.extent.length)).then_interruptible(
+                      op.extent.length)).safe_then_interruptible(
     [&delta_stats, &os, &osd_op, this](auto&& m) {
     return seastar::do_with(interval_set<uint64_t>{std::move(m)},
                            [&delta_stats, &os, &osd_op, this](auto&& extents) {
@@ -1363,7 +1363,7 @@ PGBackend::stat(
   return store->stat(c, oid);
 }
 
-PGBackend::interruptible_future<std::map<uint64_t, uint64_t>>
+PGBackend::read_errorator::future<std::map<uint64_t, uint64_t>>
 PGBackend::fiemap(
   CollectionRef c,
   const ghobject_t& oid,
index 1d7e6219ee5bfb4612382e213c0941dec06796a1..274ac10d1e8e27d92a63a198722e0ed4fe3f7ddb 100644 (file)
@@ -230,7 +230,7 @@ public:
   interruptible_future<struct stat> stat(
     CollectionRef c,
     const ghobject_t& oid) const;
-  interruptible_future<std::map<uint64_t, uint64_t>> fiemap(
+  read_errorator::future<std::map<uint64_t, uint64_t>> fiemap(
     CollectionRef c,
     const ghobject_t& oid,
     uint64_t off,
index 12b660a4d7d6691f88e12fb09a9a6ecc8819fc21..a96f1b8dd2bfdd8cfe0c6ee14c6a2cb477051c2a 100644 (file)
@@ -486,12 +486,12 @@ ReplicatedRecoveryBackend::read_object_for_push_op(
     return seastar::make_ready_future<uint64_t>(offset);
   }
   // 1. get the extents in the interested range
-  return backend->fiemap(coll, ghobject_t{oid},
-                         0, copy_subset.range_end()).then_wrapped_interruptible(
+  return interruptor::make_interruptible(backend->fiemap(coll, ghobject_t{oid},
+    0, copy_subset.range_end())).safe_then_interruptible(
     [=](auto&& fiemap_included) mutable {
     interval_set<uint64_t> extents;
     try {
-      extents.intersection_of(copy_subset, fiemap_included.get0());
+      extents.intersection_of(copy_subset, std::move(fiemap_included));
     } catch (std::exception &) {
       // if fiemap() fails, we will read nothing, as the intersection of
       // copy_subset and an empty interval_set would be empty anyway
@@ -503,7 +503,8 @@ ReplicatedRecoveryBackend::read_object_for_push_op(
     push_op->data_included.span_of(extents, offset, max_len);
     // 3. read the truncated extents
     // TODO: check if the returned extents are pruned
-    return store->readv(coll, ghobject_t{oid}, push_op->data_included, 0);
+    return interruptor::make_interruptible(store->readv(coll, ghobject_t{oid},
+      push_op->data_included, 0));
   }).safe_then_interruptible([push_op, range_end=copy_subset.range_end()](auto &&bl) {
     push_op->data.claim_append(std::move(bl));
     uint64_t recovered_to = 0;
index df078d5c661c02ae68ba80ee37a8284a30c3e573..f8abdee84871d3d422183f4293617fffce52b3c2 100644 (file)
@@ -112,7 +112,7 @@ struct seastore_test_t :
       SeaStore &seastore,
       uint64_t off,
       uint64_t len) {
-      return seastore.fiemap(coll, oid, off, len).get0();
+      return seastore.fiemap(coll, oid, off, len).unsafe_get0();
     }
 
     bufferlist readv(