From 2bc57d3fc3c2cc62d24d96a519a20385c3a0ba14 Mon Sep 17 00:00:00 2001 From: chunmei-liu Date: Sat, 19 Feb 2022 10:56:15 -0800 Subject: [PATCH] crimson/seastore: make fiemap return errorator future Signed-off-by: chunmei-liu --- src/crimson/os/alienstore/alien_store.cc | 8 ++++---- src/crimson/os/alienstore/alien_store.h | 2 +- src/crimson/os/cyanstore/cyan_store.cc | 2 +- src/crimson/os/cyanstore/cyan_store.h | 2 +- src/crimson/os/futurized_store.h | 2 +- src/crimson/os/seastore/seastore.cc | 6 ++---- src/crimson/os/seastore/seastore.h | 2 +- src/crimson/osd/pg_backend.cc | 4 ++-- src/crimson/osd/pg_backend.h | 2 +- src/crimson/osd/replicated_recovery_backend.cc | 9 +++++---- src/test/crimson/seastore/test_seastore.cc | 2 +- 11 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/crimson/os/alienstore/alien_store.cc b/src/crimson/os/alienstore/alien_store.cc index 904540a4c44ae..5035b2da14c0e 100644 --- a/src/crimson/os/alienstore/alien_store.cc +++ b/src/crimson/os/alienstore/alien_store.cc @@ -575,7 +575,7 @@ auto AlienStore::omap_get_header(CollectionRef ch, }); } -seastar::future> AlienStore::fiemap( +AlienStore::read_errorator::future> AlienStore::fiemap( CollectionRef ch, const ghobject_t& oid, uint64_t off, @@ -586,9 +586,9 @@ seastar::future> AlienStore::fiemap( return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, &destmap] { auto c = static_cast(ch.get()); return store->fiemap(c->collection, oid, off, len, destmap); - }).then([&destmap] (int i) { - return seastar::make_ready_future>( - std::move(destmap)); + }).then([&destmap](int i) { + return read_errorator::make_ready_future>( + std::move(destmap)); }); }); } diff --git a/src/crimson/os/alienstore/alien_store.h b/src/crimson/os/alienstore/alien_store.h index 7a3db432f87b6..b7927f50c91a5 100644 --- a/src/crimson/os/alienstore/alien_store.h +++ b/src/crimson/os/alienstore/alien_store.h @@ -109,7 +109,7 @@ public: read_errorator::future omap_get_header( CollectionRef, const ghobject_t&) final; - seastar::future> fiemap( + read_errorator::future> fiemap( CollectionRef, const ghobject_t&, uint64_t off, diff --git a/src/crimson/os/cyanstore/cyan_store.cc b/src/crimson/os/cyanstore/cyan_store.cc index 9122a56c0b005..f10be4ad1b7ba 100644 --- a/src/crimson/os/cyanstore/cyan_store.cc +++ b/src/crimson/os/cyanstore/cyan_store.cc @@ -831,7 +831,7 @@ seastar::future CyanStore::get_omap_iterator( new CyanStore::CyanOmapIterator(o)); } -seastar::future> +CyanStore::read_errorator::future> CyanStore::fiemap( CollectionRef ch, const ghobject_t& oid, diff --git a/src/crimson/os/cyanstore/cyan_store.h b/src/crimson/os/cyanstore/cyan_store.h index 492801e5a13be..66ef00b25a2ad 100644 --- a/src/crimson/os/cyanstore/cyan_store.h +++ b/src/crimson/os/cyanstore/cyan_store.h @@ -137,7 +137,7 @@ public: CollectionRef c, const ghobject_t& oid); - seastar::future> fiemap(CollectionRef c, + read_errorator::future> fiemap(CollectionRef c, const ghobject_t& oid, uint64_t off, uint64_t len); diff --git a/src/crimson/os/futurized_store.h b/src/crimson/os/futurized_store.h index c35cba9b05d8b..eff6cb5e5d977 100644 --- a/src/crimson/os/futurized_store.h +++ b/src/crimson/os/futurized_store.h @@ -158,7 +158,7 @@ public: virtual seastar::future get_omap_iterator( CollectionRef ch, const ghobject_t& oid) = 0; - virtual seastar::future> fiemap( + virtual read_errorator::future> fiemap( CollectionRef ch, const ghobject_t& oid, uint64_t off, diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc index 844a2e1ba059d..dde849a0af090 100644 --- a/src/crimson/os/seastore/seastore.cc +++ b/src/crimson/os/seastore/seastore.cc @@ -931,7 +931,8 @@ SeaStore::_fiemap_ret SeaStore::_fiemap( len); }); } -seastar::future> SeaStore::fiemap( + +SeaStore::read_errorator::future> SeaStore::fiemap( CollectionRef ch, const ghobject_t& oid, uint64_t off, @@ -955,9 +956,6 @@ seastar::future> 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" }); } diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h index 29e78a6f2af07..5be931cb8ec47 100644 --- a/src/crimson/os/seastore/seastore.h +++ b/src/crimson/os/seastore/seastore.h @@ -148,7 +148,7 @@ public: seastar::future get_omap_iterator( CollectionRef ch, const ghobject_t& oid) final; - seastar::future> fiemap( + read_errorator::future> fiemap( CollectionRef ch, const ghobject_t& oid, uint64_t off, diff --git a/src/crimson/osd/pg_backend.cc b/src/crimson/osd/pg_backend.cc index e45b935bb323f..627c0eb23b7f8 100644 --- a/src/crimson/osd/pg_backend.cc +++ b/src/crimson/osd/pg_backend.cc @@ -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{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> +PGBackend::read_errorator::future> PGBackend::fiemap( CollectionRef c, const ghobject_t& oid, diff --git a/src/crimson/osd/pg_backend.h b/src/crimson/osd/pg_backend.h index 1d7e6219ee5bf..274ac10d1e8e2 100644 --- a/src/crimson/osd/pg_backend.h +++ b/src/crimson/osd/pg_backend.h @@ -230,7 +230,7 @@ public: interruptible_future stat( CollectionRef c, const ghobject_t& oid) const; - interruptible_future> fiemap( + read_errorator::future> fiemap( CollectionRef c, const ghobject_t& oid, uint64_t off, diff --git a/src/crimson/osd/replicated_recovery_backend.cc b/src/crimson/osd/replicated_recovery_backend.cc index 12b660a4d7d66..a96f1b8dd2bfd 100644 --- a/src/crimson/osd/replicated_recovery_backend.cc +++ b/src/crimson/osd/replicated_recovery_backend.cc @@ -486,12 +486,12 @@ ReplicatedRecoveryBackend::read_object_for_push_op( return seastar::make_ready_future(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 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; diff --git a/src/test/crimson/seastore/test_seastore.cc b/src/test/crimson/seastore/test_seastore.cc index df078d5c661c0..f8abdee84871d 100644 --- a/src/test/crimson/seastore/test_seastore.cc +++ b/src/test/crimson/seastore/test_seastore.cc @@ -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( -- 2.39.5