summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYingxin Cheng <yingxin.cheng@intel.com>2025-01-09 11:08:35 +0100
committerGitHub <noreply@github.com>2025-01-09 11:08:35 +0100
commit10c9a4d252f8f21f324ffcdff81b3f1ef033d4f9 (patch)
tree3876b7f2bb4d86f7edb99b98bfc0b5474f65dc26
parentMerge pull request #60848 from cbodley/wip-rgw-deprecate-iam-tenant (diff)
parentcrimson/osd/replicated_recovery_backend: prevent recovery/backfills from (diff)
downloadceph-10c9a4d252f8f21f324ffcdff81b3f1ef033d4f9.tar.xz
ceph-10c9a4d252f8f21f324ffcdff81b3f1ef033d4f9.zip
Merge pull request #60891 from xxhdx1985126/wip-seastore-fadvise-backfill
crimson/os/seastore: add fadvise support to SeaStore and prevent recovery/backfill from polluting the cache of SeaStore Reviewed-by: Yingxin Cheng <yingxin.cheng@intel.com> Reviewed-by: Matan Breizman <mbreizma@redhat.com>
-rw-r--r--src/crimson/os/alienstore/alien_store.cc27
-rw-r--r--src/crimson/os/alienstore/alien_store.h35
-rw-r--r--src/crimson/os/cyanstore/cyan_store.cc27
-rw-r--r--src/crimson/os/cyanstore/cyan_store.h27
-rw-r--r--src/crimson/os/futurized_store.h27
-rw-r--r--src/crimson/os/seastore/async_cleaner.cc6
-rw-r--r--src/crimson/os/seastore/async_cleaner.h14
-rw-r--r--src/crimson/os/seastore/cache.cc8
-rw-r--r--src/crimson/os/seastore/cache.h23
-rw-r--r--src/crimson/os/seastore/seastore.cc49
-rw-r--r--src/crimson/os/seastore/seastore.h36
-rw-r--r--src/crimson/os/seastore/seastore_types.h33
-rw-r--r--src/crimson/os/seastore/transaction.h15
-rw-r--r--src/crimson/os/seastore/transaction_manager.cc2
-rw-r--r--src/crimson/os/seastore/transaction_manager.h3
-rw-r--r--src/crimson/osd/pg_backend.cc15
-rw-r--r--src/crimson/osd/pg_backend.h9
-rw-r--r--src/crimson/osd/replicated_recovery_backend.cc27
-rw-r--r--src/crimson/tools/store_nbd/tm_driver.cc2
-rw-r--r--src/test/crimson/seastore/test_btree_lba_manager.cc25
-rw-r--r--src/test/crimson/seastore/test_seastore_cache.cc5
21 files changed, 297 insertions, 118 deletions
diff --git a/src/crimson/os/alienstore/alien_store.cc b/src/crimson/os/alienstore/alien_store.cc
index f390823a8a0..a9c69f4660e 100644
--- a/src/crimson/os/alienstore/alien_store.cc
+++ b/src/crimson/os/alienstore/alien_store.cc
@@ -141,7 +141,8 @@ seastar::future<> AlienStore::stop()
AlienStore::base_errorator::future<bool>
AlienStore::exists(
CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
return op_gates.simple_dispatch("exists", [=, this] {
return tp->submit(ch->get_cid().hash_to_shard(tp->size()), [=, this] {
@@ -212,7 +213,8 @@ seastar::future<std::tuple<std::vector<ghobject_t>, ghobject_t>>
AlienStore::list_objects(CollectionRef ch,
const ghobject_t& start,
const ghobject_t& end,
- uint64_t limit) const
+ uint64_t limit,
+ uint32_t op_flags) const
{
logger().debug("{}", __func__);
assert(tp);
@@ -348,7 +350,8 @@ AlienStore::readv(CollectionRef ch,
AlienStore::get_attr_errorator::future<ceph::bufferlist>
AlienStore::get_attr(CollectionRef ch,
const ghobject_t& oid,
- std::string_view name) const
+ std::string_view name,
+ uint32_t op_flags) const
{
logger().debug("{}", __func__);
assert(tp);
@@ -376,7 +379,8 @@ AlienStore::get_attr(CollectionRef ch,
AlienStore::get_attrs_ertr::future<AlienStore::attrs_t>
AlienStore::get_attrs(CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
logger().debug("{}", __func__);
assert(tp);
@@ -397,7 +401,8 @@ AlienStore::get_attrs(CollectionRef ch,
auto AlienStore::omap_get_values(CollectionRef ch,
const ghobject_t& oid,
- const set<string>& keys)
+ const set<string>& keys,
+ uint32_t op_flags)
-> read_errorator::future<omap_values_t>
{
logger().debug("{}", __func__);
@@ -421,7 +426,8 @@ auto AlienStore::omap_get_values(CollectionRef ch,
auto AlienStore::omap_get_values(CollectionRef ch,
const ghobject_t &oid,
- const std::optional<string> &start)
+ const std::optional<string> &start,
+ uint32_t op_flags)
-> read_errorator::future<std::tuple<bool, omap_values_t>>
{
logger().debug("{} with_start", __func__);
@@ -578,7 +584,8 @@ unsigned AlienStore::get_max_attr_name_length() const
seastar::future<struct stat> AlienStore::stat(
CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
assert(tp);
return do_with_op_gate((struct stat){}, [this, ch, oid](auto& st) {
@@ -604,7 +611,8 @@ seastar::future<std::string> AlienStore::get_default_device_class()
}
auto AlienStore::omap_get_header(CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
-> get_attr_errorator::future<ceph::bufferlist>
{
assert(tp);
@@ -630,7 +638,8 @@ AlienStore::read_errorator::future<std::map<uint64_t, uint64_t>> AlienStore::fie
CollectionRef ch,
const ghobject_t& oid,
uint64_t off,
- uint64_t len)
+ uint64_t len,
+ uint32_t op_flags)
{
assert(tp);
return do_with_op_gate(std::map<uint64_t, uint64_t>(), [=, this](auto& destmap) {
diff --git a/src/crimson/os/alienstore/alien_store.h b/src/crimson/os/alienstore/alien_store.h
index 853585dac9c..1d39411450e 100644
--- a/src/crimson/os/alienstore/alien_store.h
+++ b/src/crimson/os/alienstore/alien_store.h
@@ -36,7 +36,8 @@ public:
base_errorator::future<bool> exists(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
mkfs_ertr::future<> mkfs(uuid_d new_osd_fsid) final;
read_errorator::future<ceph::bufferlist> read(CollectionRef c,
const ghobject_t& oid,
@@ -49,29 +50,36 @@ public:
uint32_t op_flags = 0) final;
- get_attr_errorator::future<ceph::bufferlist> get_attr(CollectionRef c,
- const ghobject_t& oid,
- std::string_view name) const final;
- get_attrs_ertr::future<attrs_t> get_attrs(CollectionRef c,
- const ghobject_t& oid) final;
+ get_attr_errorator::future<ceph::bufferlist> get_attr(
+ CollectionRef c,
+ const ghobject_t& oid,
+ std::string_view name,
+ uint32_t op_flags = 0) const final;
+ get_attrs_ertr::future<attrs_t> get_attrs(
+ CollectionRef c,
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
read_errorator::future<omap_values_t> omap_get_values(
CollectionRef c,
const ghobject_t& oid,
- const omap_keys_t& keys) final;
+ const omap_keys_t& keys,
+ uint32_t op_flags = 0) final;
/// Retrieves paged set of values > start (if present)
read_errorator::future<std::tuple<bool, omap_values_t>> omap_get_values(
CollectionRef c, ///< [in] collection
const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start ///< [in] start, empty for begin
+ const std::optional<std::string> &start, ///< [in] start, empty for begin
+ uint32_t op_flags = 0
) final; ///< @return <done, values> values.empty() iff done
seastar::future<std::tuple<std::vector<ghobject_t>, ghobject_t>> list_objects(
CollectionRef c,
const ghobject_t& start,
const ghobject_t& end,
- uint64_t limit) const final;
+ uint64_t limit,
+ uint32_t op_flags = 0) const final;
seastar::future<CollectionRef> create_new_collection(const coll_t& cid) final;
seastar::future<CollectionRef> open_collection(const coll_t& cid) final;
@@ -97,16 +105,19 @@ public:
unsigned get_max_attr_name_length() const final;
seastar::future<struct stat> stat(
CollectionRef,
- const ghobject_t&) final;
+ const ghobject_t&,
+ uint32_t op_flags = 0) final;
seastar::future<std::string> get_default_device_class() final;
get_attr_errorator::future<ceph::bufferlist> omap_get_header(
CollectionRef,
- const ghobject_t&) final;
+ const ghobject_t&,
+ uint32_t) final;
read_errorator::future<std::map<uint64_t, uint64_t>> fiemap(
CollectionRef,
const ghobject_t&,
uint64_t off,
- uint64_t len) final;
+ uint64_t len,
+ uint32_t op_flags) final;
FuturizedStore::Shard& get_sharded_store() final {
return *this;
diff --git a/src/crimson/os/cyanstore/cyan_store.cc b/src/crimson/os/cyanstore/cyan_store.cc
index a8bf514de15..41819fb5eb6 100644
--- a/src/crimson/os/cyanstore/cyan_store.cc
+++ b/src/crimson/os/cyanstore/cyan_store.cc
@@ -208,7 +208,8 @@ CyanStore::Shard::list_objects(
CollectionRef ch,
const ghobject_t& start,
const ghobject_t& end,
- uint64_t limit) const
+ uint64_t limit,
+ uint32_t op_flags) const
{
auto c = static_cast<Collection*>(ch.get());
logger().debug("{} {} {} {} {}",
@@ -257,7 +258,8 @@ CyanStore::Shard::list_collections()
CyanStore::Shard::base_errorator::future<bool>
CyanStore::Shard::exists(
CollectionRef ch,
- const ghobject_t &oid)
+ const ghobject_t &oid,
+ uint32_t op_flags)
{
auto c = static_cast<Collection*>(ch.get());
if (!c->exists) {
@@ -333,7 +335,8 @@ CyanStore::Shard::get_attr_errorator::future<ceph::bufferlist>
CyanStore::Shard::get_attr(
CollectionRef ch,
const ghobject_t& oid,
- std::string_view name) const
+ std::string_view name,
+ uint32_t op_flags) const
{
auto c = static_cast<Collection*>(ch.get());
logger().debug("{} {} {}",
@@ -352,7 +355,8 @@ CyanStore::Shard::get_attr(
CyanStore::Shard::get_attrs_ertr::future<CyanStore::Shard::attrs_t>
CyanStore::Shard::get_attrs(
CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
auto c = static_cast<Collection*>(ch.get());
logger().debug("{} {} {}",
@@ -367,7 +371,8 @@ CyanStore::Shard::get_attrs(
auto CyanStore::Shard::omap_get_values(
CollectionRef ch,
const ghobject_t& oid,
- const omap_keys_t& keys)
+ const omap_keys_t& keys,
+ uint32_t op_flags)
-> read_errorator::future<omap_values_t>
{
auto c = static_cast<Collection*>(ch.get());
@@ -388,7 +393,8 @@ auto CyanStore::Shard::omap_get_values(
auto CyanStore::Shard::omap_get_values(
CollectionRef ch,
const ghobject_t &oid,
- const std::optional<string> &start)
+ const std::optional<string> &start,
+ uint32_t op_flags)
-> CyanStore::Shard::read_errorator::future<std::tuple<bool, omap_values_t>>
{
auto c = static_cast<Collection*>(ch.get());
@@ -409,7 +415,8 @@ auto CyanStore::Shard::omap_get_values(
auto CyanStore::Shard::omap_get_header(
CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
-> CyanStore::Shard::get_attr_errorator::future<ceph::bufferlist>
{
auto c = static_cast<Collection*>(ch.get());
@@ -977,7 +984,8 @@ CyanStore::Shard::fiemap(
CollectionRef ch,
const ghobject_t& oid,
uint64_t off,
- uint64_t len)
+ uint64_t len,
+ uint32_t op_flags)
{
auto c = static_cast<Collection*>(ch.get());
@@ -992,7 +1000,8 @@ CyanStore::Shard::fiemap(
seastar::future<struct stat>
CyanStore::Shard::stat(
CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
auto c = static_cast<Collection*>(ch.get());
auto o = c->get_object(oid);
diff --git a/src/crimson/os/cyanstore/cyan_store.h b/src/crimson/os/cyanstore/cyan_store.h
index e9394991bc2..1d481ef5829 100644
--- a/src/crimson/os/cyanstore/cyan_store.h
+++ b/src/crimson/os/cyanstore/cyan_store.h
@@ -34,11 +34,13 @@ public:
seastar::future<struct stat> stat(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
base_errorator::future<bool> exists(
CollectionRef ch,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
read_errorator::future<ceph::bufferlist> read(
CollectionRef c,
@@ -56,33 +58,39 @@ public:
get_attr_errorator::future<ceph::bufferlist> get_attr(
CollectionRef c,
const ghobject_t& oid,
- std::string_view name) const final;
+ std::string_view name,
+ uint32_t op_flags = 0) const final;
get_attrs_ertr::future<attrs_t> get_attrs(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
read_errorator::future<omap_values_t> omap_get_values(
CollectionRef c,
const ghobject_t& oid,
- const omap_keys_t& keys) final;
+ const omap_keys_t& keys,
+ uint32_t op_flags = 0) final;
read_errorator::future<std::tuple<bool, omap_values_t>> omap_get_values(
CollectionRef c, ///< [in] collection
const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start ///< [in] start, empty for begin
+ const std::optional<std::string> &start, ///< [in] start, empty for begin
+ uint32_t op_flags = 0
) final;
get_attr_errorator::future<ceph::bufferlist> omap_get_header(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
seastar::future<std::tuple<std::vector<ghobject_t>, ghobject_t>>
list_objects(
CollectionRef c,
const ghobject_t& start,
const ghobject_t& end,
- uint64_t limit) const final;
+ uint64_t limit,
+ uint32_t op_flags = 0) const final;
seastar::future<CollectionRef> create_new_collection(const coll_t& cid) final;
@@ -101,7 +109,8 @@ public:
CollectionRef c,
const ghobject_t& oid,
uint64_t off,
- uint64_t len) final;
+ uint64_t len,
+ uint32_t op_flags) final;
unsigned get_max_attr_name_length() const final;
diff --git a/src/crimson/os/futurized_store.h b/src/crimson/os/futurized_store.h
index 51ef2331014..e7d4c8546de 100644
--- a/src/crimson/os/futurized_store.h
+++ b/src/crimson/os/futurized_store.h
@@ -54,7 +54,8 @@ public:
virtual base_errorator::future<bool> exists(
CollectionRef c,
- const ghobject_t& oid) = 0;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) = 0;
using get_attr_errorator = crimson::errorator<
crimson::ct_error::enoent,
@@ -62,42 +63,49 @@ public:
virtual get_attr_errorator::future<ceph::bufferlist> get_attr(
CollectionRef c,
const ghobject_t& oid,
- std::string_view name) const = 0;
+ std::string_view name,
+ uint32_t op_flags = 0) const = 0;
using get_attrs_ertr = crimson::errorator<
crimson::ct_error::enoent>;
using attrs_t = std::map<std::string, ceph::bufferlist, std::less<>>;
virtual get_attrs_ertr::future<attrs_t> get_attrs(
CollectionRef c,
- const ghobject_t& oid) = 0;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) = 0;
virtual seastar::future<struct stat> stat(
CollectionRef c,
- const ghobject_t& oid) = 0;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) = 0;
using omap_values_t = attrs_t;
using omap_keys_t = std::set<std::string>;
virtual read_errorator::future<omap_values_t> omap_get_values(
CollectionRef c,
const ghobject_t& oid,
- const omap_keys_t& keys) = 0;
+ const omap_keys_t& keys,
+ uint32_t op_flags = 0) = 0;
using omap_values_paged_t = std::tuple<bool, omap_values_t>;
virtual read_errorator::future<omap_values_paged_t> omap_get_values(
CollectionRef c, ///< [in] collection
const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start ///< [in] start, empty for begin
+ const std::optional<std::string> &start, ///< [in] start, empty for begin
+ uint32_t op_flags = 0
) = 0; ///< @return <done, values> values.empty() only if done
virtual get_attr_errorator::future<bufferlist> omap_get_header(
CollectionRef c,
- const ghobject_t& oid) = 0;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) = 0;
virtual seastar::future<std::tuple<std::vector<ghobject_t>, ghobject_t>> list_objects(
CollectionRef c,
const ghobject_t& start,
const ghobject_t& end,
- uint64_t limit) const = 0;
+ uint64_t limit,
+ uint32_t op_flags = 0) const = 0;
virtual seastar::future<CollectionRef> create_new_collection(const coll_t& cid) = 0;
@@ -153,7 +161,8 @@ public:
CollectionRef ch,
const ghobject_t& oid,
uint64_t off,
- uint64_t len) = 0;
+ uint64_t len,
+ uint32_t op_flags = 0) = 0;
virtual unsigned get_max_attr_name_length() const = 0;
};
diff --git a/src/crimson/os/seastore/async_cleaner.cc b/src/crimson/os/seastore/async_cleaner.cc
index 341c5c5524a..64e6749562e 100644
--- a/src/crimson/os/seastore/async_cleaner.cc
+++ b/src/crimson/os/seastore/async_cleaner.cc
@@ -609,6 +609,7 @@ JournalTrimmerImpl::trim_alloc()
return extent_callback->with_transaction_intr(
Transaction::src_t::TRIM_ALLOC,
"trim_alloc",
+ CACHE_HINT_NOCACHE,
[this, FNAME](auto &t)
{
auto target = get_alloc_tail_target();
@@ -653,6 +654,7 @@ JournalTrimmerImpl::trim_dirty()
return extent_callback->with_transaction_intr(
Transaction::src_t::TRIM_DIRTY,
"trim_dirty",
+ CACHE_HINT_NOCACHE,
[this, FNAME](auto &t)
{
auto target = get_dirty_tail_target();
@@ -1125,6 +1127,7 @@ SegmentCleaner::do_reclaim_space(
return extent_callback->with_transaction_intr(
src,
"clean_reclaim_space",
+ CACHE_HINT_NOCACHE,
[this, &backref_extents, &pin_list, &reclaimed](auto &t)
{
return seastar::do_with(
@@ -1240,6 +1243,7 @@ SegmentCleaner::clean_space_ret SegmentCleaner::clean_space()
return extent_callback->with_transaction_intr(
Transaction::src_t::READ,
"retrieve_from_backref_tree",
+ CACHE_HINT_NOCACHE,
[this, &weak_read_ret](auto &t) {
return backref_manager.get_mappings(
t,
@@ -1506,6 +1510,7 @@ bool SegmentCleaner::check_usage()
SpaceTrackerIRef tracker(space_tracker->make_empty());
extent_callback->with_transaction_weak(
"check_usage",
+ CACHE_HINT_NOCACHE,
[this, &tracker](auto &t) {
return backref_manager.scan_mapped_space(
t,
@@ -1812,6 +1817,7 @@ bool RBMCleaner::check_usage()
RBMSpaceTracker tracker(rbms);
extent_callback->with_transaction_weak(
"check_usage",
+ CACHE_HINT_NOCACHE,
[this, &tracker, &rbms](auto &t) {
return backref_manager.scan_mapped_space(
t,
diff --git a/src/crimson/os/seastore/async_cleaner.h b/src/crimson/os/seastore/async_cleaner.h
index 424247c5bdc..01ab44c4c7c 100644
--- a/src/crimson/os/seastore/async_cleaner.h
+++ b/src/crimson/os/seastore/async_cleaner.h
@@ -299,24 +299,29 @@ public:
/// Creates empty transaction
/// weak transaction should be type READ
virtual TransactionRef create_transaction(
- Transaction::src_t, const char *name, bool is_weak=false) = 0;
+ Transaction::src_t,
+ const char *name,
+ cache_hint_t cache_hint = CACHE_HINT_TOUCH,
+ bool is_weak=false) = 0;
/// Creates empty transaction with interruptible context
template <typename Func>
auto with_transaction_intr(
Transaction::src_t src,
const char* name,
+ cache_hint_t cache_hint,
Func &&f) {
return do_with_transaction_intr<Func, false>(
- src, name, std::forward<Func>(f));
+ src, name, cache_hint, std::forward<Func>(f));
}
template <typename Func>
auto with_transaction_weak(
const char* name,
+ cache_hint_t cache_hint,
Func &&f) {
return do_with_transaction_intr<Func, true>(
- Transaction::src_t::READ, name, std::forward<Func>(f)
+ Transaction::src_t::READ, name, cache_hint, std::forward<Func>(f)
).handle_error(
crimson::ct_error::eagain::assert_failure{"unexpected eagain"},
crimson::ct_error::pass_further_all{}
@@ -385,9 +390,10 @@ private:
auto do_with_transaction_intr(
Transaction::src_t src,
const char* name,
+ cache_hint_t cache_hint,
Func &&f) {
return seastar::do_with(
- create_transaction(src, name, IsWeak),
+ create_transaction(src, name, cache_hint, IsWeak),
[f=std::forward<Func>(f)](auto &ref_t) mutable {
return with_trans_intr(
*ref_t,
diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc
index 5898b9bad0a..86f816e1648 100644
--- a/src/crimson/os/seastore/cache.cc
+++ b/src/crimson/os/seastore/cache.cc
@@ -1483,7 +1483,7 @@ record_t Cache::prepare_record(
i->state = CachedExtent::extent_state_t::CLEAN;
assert(i->is_logical());
i->clear_modified_region();
- touch_extent(*i, &trans_src);
+ touch_extent(*i, &trans_src, t.get_cache_hint());
DEBUGT("inplace rewrite ool block is commmitted -- {}", t, *i);
}
@@ -1513,7 +1513,7 @@ record_t Cache::prepare_record(
if (i->is_dirty()) {
add_to_dirty(i, &t_src);
} else {
- touch_extent(*i, &t_src);
+ touch_extent(*i, &t_src, t.get_cache_hint());
}
alloc_delta.alloc_blk_ranges.emplace_back(
@@ -1759,7 +1759,7 @@ void Cache::complete_commit(
add_extent(i);
assert(!i->is_dirty());
const auto t_src = t.get_src();
- touch_extent(*i, &t_src);
+ touch_extent(*i, &t_src, t.get_cache_hint());
epm.commit_space_used(i->get_paddr(), i->get_length());
// Note: commit extents and backref allocations in the same place
@@ -2026,7 +2026,7 @@ Cache::replay_delta(
[](CachedExtent &) {},
[this](CachedExtent &ext) {
// replay is not included by the cache hit metrics
- touch_extent(ext, nullptr);
+ touch_extent(ext, nullptr, CACHE_HINT_TOUCH);
},
nullptr) :
_get_extent_if_cached(
diff --git a/src/crimson/os/seastore/cache.h b/src/crimson/os/seastore/cache.h
index b2248ff37dd..a239b861726 100644
--- a/src/crimson/os/seastore/cache.h
+++ b/src/crimson/os/seastore/cache.h
@@ -124,6 +124,7 @@ public:
TransactionRef create_transaction(
Transaction::src_t src,
const char* name,
+ cache_hint_t cache_hint,
bool is_weak) {
LOG_PREFIX(Cache::create_transaction);
@@ -137,7 +138,8 @@ public:
[this](Transaction& t) {
return on_transaction_destruct(t);
},
- ++next_id
+ ++next_id,
+ cache_hint
);
SUBDEBUGT(seastore_t, "created name={}, source={}, is_weak={}",
*ret, name, src, is_weak);
@@ -284,7 +286,7 @@ public:
SUBDEBUGT(seastore_cache, "{} {} is present in cache -- {}",
t, type, offset, *ret);
t.add_to_read_set(ret);
- touch_extent(*ret, &t_src);
+ touch_extent(*ret, &t_src, t.get_cache_hint());
return ret->wait_io().then([ret] {
return get_extent_if_cached_iertr::make_ready_future<
CachedExtentRef>(ret);
@@ -341,7 +343,7 @@ public:
t, T::TYPE, offset, length);
auto f = [&t, this, t_src](CachedExtent &ext) {
t.add_to_read_set(CachedExtentRef(&ext));
- touch_extent(ext, &t_src);
+ touch_extent(ext, &t_src, t.get_cache_hint());
};
return trans_intr::make_interruptible(
do_get_caching_extent<T>(
@@ -389,7 +391,7 @@ public:
++stats.access.s.load_absent;
t.add_to_read_set(CachedExtentRef(&ext));
- touch_extent(ext, &t_src);
+ touch_extent(ext, &t_src, t.get_cache_hint());
};
return trans_intr::make_interruptible(
do_get_caching_extent<T>(
@@ -487,7 +489,7 @@ public:
++access_stats.cache_lru;
++stats.access.s.cache_lru;
}
- touch_extent(*p_extent, &t_src);
+ touch_extent(*p_extent, &t_src, t.get_cache_hint());
} else {
if (p_extent->is_dirty()) {
++access_stats.trans_dirty;
@@ -834,7 +836,7 @@ private:
t, type, offset, length, laddr);
auto f = [&t, this, t_src](CachedExtent &ext) {
t.add_to_read_set(CachedExtentRef(&ext));
- touch_extent(ext, &t_src);
+ touch_extent(ext, &t_src, t.get_cache_hint());
};
return trans_intr::make_interruptible(
do_get_caching_extent_by_type(
@@ -876,7 +878,7 @@ private:
++stats.access.s.load_absent;
t.add_to_read_set(CachedExtentRef(&ext));
- touch_extent(ext, &t_src);
+ touch_extent(ext, &t_src, t.get_cache_hint());
};
return trans_intr::make_interruptible(
do_get_caching_extent_by_type(
@@ -1472,11 +1474,10 @@ private:
/// Update lru for access to ref
void touch_extent(
CachedExtent &ext,
- const Transaction::src_t* p_src)
+ const Transaction::src_t* p_src,
+ cache_hint_t hint)
{
- if (p_src &&
- is_background_transaction(*p_src) &&
- is_logical_type(ext.get_type())) {
+ if (hint == CACHE_HINT_NOCACHE && is_logical_type(ext.get_type())) {
return;
}
if (ext.is_stable_clean() && !ext.is_placeholder()) {
diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc
index 5b51083f344..6a866cb1f9b 100644
--- a/src/crimson/os/seastore/seastore.cc
+++ b/src/crimson/os/seastore/seastore.cc
@@ -408,6 +408,7 @@ SeaStore::Shard::mkfs_managers()
return transaction_manager->with_transaction_intr(
Transaction::src_t::MUTATE,
"mkfs_seastore",
+ CACHE_HINT_TOUCH,
[this](auto& t)
{
LOG_PREFIX(SeaStoreS::mkfs_managers);
@@ -897,9 +898,10 @@ get_ranges(CollectionRef ch,
seastar::future<std::tuple<std::vector<ghobject_t>, ghobject_t>>
SeaStore::Shard::list_objects(CollectionRef ch,
- const ghobject_t& start,
- const ghobject_t& end,
- uint64_t limit) const
+ const ghobject_t& start,
+ const ghobject_t& end,
+ uint64_t limit,
+ uint32_t op_flags) const
{
++(shard_stats.read_num);
++(shard_stats.pending_read_num);
@@ -910,13 +912,14 @@ SeaStore::Shard::list_objects(CollectionRef ch,
return seastar::do_with(
RetType(std::vector<ghobject_t>(), start),
std::move(limit),
- [this, ch, start, end](auto& ret, auto& limit) {
- return repeat_eagain([this, ch, start, end, &limit, &ret] {
+ [this, ch, start, end, op_flags](auto& ret, auto& limit) {
+ return repeat_eagain([this, ch, start, end, &limit, &ret, op_flags] {
++(shard_stats.repeat_read_num);
return transaction_manager->with_transaction_intr(
Transaction::src_t::READ,
"list_objects",
+ op_flags,
[this, ch, start, end, &limit, &ret](auto &t)
{
LOG_PREFIX(SeaStoreS::list_objects);
@@ -1054,6 +1057,7 @@ SeaStore::Shard::list_collections()
return transaction_manager->with_transaction_intr(
Transaction::src_t::READ,
"list_collections",
+ CACHE_HINT_TOUCH,
[this, &ret](auto& t)
{
LOG_PREFIX(SeaStoreS::list_collections);
@@ -1137,6 +1141,7 @@ SeaStore::Shard::read(
Transaction::src_t::READ,
"read",
op_type_t::READ,
+ op_flags,
[this, offset, len, op_flags](auto &t, auto &onode) {
return _read(t, onode, offset, len, op_flags);
}).finally([this] {
@@ -1148,7 +1153,8 @@ SeaStore::Shard::read(
SeaStore::Shard::base_errorator::future<bool>
SeaStore::Shard::exists(
CollectionRef c,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
LOG_PREFIX(SeaStoreS::exists);
++(shard_stats.read_num);
@@ -1160,6 +1166,7 @@ SeaStore::Shard::exists(
Transaction::src_t::READ,
"exists",
op_type_t::READ,
+ op_flags,
[FNAME](auto& t, auto&) {
DEBUGT("exists", t);
return seastar::make_ready_future<bool>(true);
@@ -1240,7 +1247,8 @@ SeaStore::Shard::get_attr_errorator::future<ceph::bufferlist>
SeaStore::Shard::get_attr(
CollectionRef ch,
const ghobject_t& oid,
- std::string_view name) const
+ std::string_view name,
+ uint32_t op_flags) const
{
++(shard_stats.read_num);
++(shard_stats.pending_read_num);
@@ -1251,6 +1259,7 @@ SeaStore::Shard::get_attr(
Transaction::src_t::READ,
"get_attr",
op_type_t::GET_ATTR,
+ op_flags,
[this, name](auto &t, auto& onode) {
return _get_attr(t, onode, name);
}).handle_error(
@@ -1296,7 +1305,8 @@ SeaStore::Shard::_get_attrs(
SeaStore::Shard::get_attrs_ertr::future<SeaStore::Shard::attrs_t>
SeaStore::Shard::get_attrs(
CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
++(shard_stats.read_num);
++(shard_stats.pending_read_num);
@@ -1307,6 +1317,7 @@ SeaStore::Shard::get_attrs(
Transaction::src_t::READ,
"get_attrs",
op_type_t::GET_ATTRS,
+ op_flags,
[this](auto &t, auto& onode) {
return _get_attrs(t, onode);
}).handle_error(
@@ -1338,7 +1349,8 @@ seastar::future<struct stat> SeaStore::Shard::_stat(
seastar::future<struct stat> SeaStore::Shard::stat(
CollectionRef c,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
++(shard_stats.read_num);
++(shard_stats.pending_read_num);
@@ -1349,6 +1361,7 @@ seastar::future<struct stat> SeaStore::Shard::stat(
Transaction::src_t::READ,
"stat",
op_type_t::STAT,
+ op_flags,
[this, oid](auto &t, auto &onode) {
return _stat(t, onode, oid);
}).handle_error(
@@ -1364,9 +1377,10 @@ seastar::future<struct stat> SeaStore::Shard::stat(
SeaStore::Shard::get_attr_errorator::future<ceph::bufferlist>
SeaStore::Shard::omap_get_header(
CollectionRef ch,
- const ghobject_t& oid)
+ const ghobject_t& oid,
+ uint32_t op_flags)
{
- return get_attr(ch, oid, OMAP_HEADER_XATTR_KEY);
+ return get_attr(ch, oid, OMAP_HEADER_XATTR_KEY, op_flags);
}
SeaStore::base_iertr::future<SeaStore::Shard::omap_values_t>
@@ -1389,7 +1403,8 @@ SeaStore::Shard::read_errorator::future<SeaStore::Shard::omap_values_t>
SeaStore::Shard::omap_get_values(
CollectionRef ch,
const ghobject_t &oid,
- const omap_keys_t &keys)
+ const omap_keys_t &keys,
+ uint32_t op_flags)
{
++(shard_stats.read_num);
++(shard_stats.pending_read_num);
@@ -1400,6 +1415,7 @@ SeaStore::Shard::omap_get_values(
Transaction::src_t::READ,
"omap_get_values",
op_type_t::OMAP_GET_VALUES,
+ op_flags,
[this, keys](auto &t, auto &onode) {
return do_omap_get_values(t, onode, keys);
}).finally([this] {
@@ -1529,7 +1545,8 @@ SeaStore::Shard::read_errorator::future<SeaStore::Shard::omap_values_paged_t>
SeaStore::Shard::omap_get_values(
CollectionRef ch,
const ghobject_t &oid,
- const std::optional<std::string> &start)
+ const std::optional<std::string> &start,
+ uint32_t op_flags)
{
++(shard_stats.read_num);
++(shard_stats.pending_read_num);
@@ -1540,6 +1557,7 @@ SeaStore::Shard::omap_get_values(
Transaction::src_t::READ,
"omap_get_values2",
op_type_t::OMAP_GET_VALUES2,
+ op_flags,
[this, start](auto &t, auto &onode) {
return do_omap_get_values(t, onode, start);
}).finally([this] {
@@ -1589,7 +1607,8 @@ SeaStore::Shard::fiemap(
CollectionRef ch,
const ghobject_t& oid,
uint64_t off,
- uint64_t len)
+ uint64_t len,
+ uint32_t op_flags)
{
++(shard_stats.read_num);
++(shard_stats.pending_read_num);
@@ -1600,6 +1619,7 @@ SeaStore::Shard::fiemap(
Transaction::src_t::READ,
"fiemap",
op_type_t::READ,
+ op_flags,
[this, off, len](auto &t, auto &onode) {
return _fiemap(t, onode, off, len);
}).finally([this] {
@@ -2677,6 +2697,7 @@ seastar::future<> SeaStore::Shard::write_meta(
return transaction_manager->with_transaction_intr(
Transaction::src_t::MUTATE,
"write_meta",
+ CACHE_HINT_NOCACHE,
[this, &key, &value](auto& t)
{
LOG_PREFIX(SeaStoreS::write_meta);
diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h
index fd7e177da63..e2a993b9e20 100644
--- a/src/crimson/os/seastore/seastore.h
+++ b/src/crimson/os/seastore/seastore.h
@@ -101,7 +101,8 @@ public:
seastar::future<struct stat> stat(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
read_errorator::future<ceph::bufferlist> read(
CollectionRef c,
@@ -118,32 +119,38 @@ public:
base_errorator::future<bool> exists(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
get_attr_errorator::future<ceph::bufferlist> get_attr(
CollectionRef c,
const ghobject_t& oid,
- std::string_view name) const final;
+ std::string_view name,
+ uint32_t op_flags = 0) const final;
get_attrs_ertr::future<attrs_t> get_attrs(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
read_errorator::future<omap_values_t> omap_get_values(
CollectionRef c,
const ghobject_t& oid,
- const omap_keys_t& keys) final;
+ const omap_keys_t& keys,
+ uint32_t op_flags = 0) final;
/// Retrieves paged set of values > start (if present)
read_errorator::future<omap_values_paged_t> omap_get_values(
CollectionRef c, ///< [in] collection
const ghobject_t &oid, ///< [in] oid
- const std::optional<std::string> &start ///< [in] start, empty for begin
+ const std::optional<std::string> &start, ///< [in] start, empty for begin
+ uint32_t op_flags = 0
) final; ///< @return <done, values> values.empty() iff done
get_attr_errorator::future<bufferlist> omap_get_header(
CollectionRef c,
- const ghobject_t& oid) final;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) final;
/// std::get<1>(ret) returns end if and only if the listing has listed all
/// the items within the range, otherwise it returns the next key to be listed.
@@ -151,7 +158,8 @@ public:
CollectionRef c,
const ghobject_t& start,
const ghobject_t& end,
- uint64_t limit) const final;
+ uint64_t limit,
+ uint32_t op_flags = 0) const final;
seastar::future<CollectionRef> create_new_collection(const coll_t& cid) final;
seastar::future<CollectionRef> open_collection(const coll_t& cid) final;
@@ -170,7 +178,8 @@ public:
CollectionRef ch,
const ghobject_t& oid,
uint64_t off,
- uint64_t len) final;
+ uint64_t len,
+ uint32_t op_flags = 0) final;
unsigned get_max_attr_name_length() const final {
return 256;
@@ -251,7 +260,8 @@ public:
return seastar::do_with(
internal_context_t(
ch, std::move(t),
- transaction_manager->create_transaction(src, tname)),
+ transaction_manager->create_transaction(
+ src, tname, t.get_fadvise_flags())),
std::forward<F>(f),
[this, op_type](auto &ctx, auto &f) {
assert(shard_stats.starting_io_num);
@@ -298,20 +308,22 @@ public:
Transaction::src_t src,
const char* tname,
op_type_t op_type,
+ cache_hint_t cache_hint_flags,
F &&f) const {
auto begin_time = std::chrono::steady_clock::now();
return seastar::do_with(
oid, Ret{}, std::forward<F>(f),
- [this, ch, src, op_type, begin_time, tname
+ [this, ch, src, op_type, begin_time, tname, cache_hint_flags
](auto &oid, auto &ret, auto &f)
{
- return repeat_eagain([&, this, ch, src, tname] {
+ return repeat_eagain([&, this, ch, src, tname, cache_hint_flags] {
assert(src == Transaction::src_t::READ);
++(shard_stats.repeat_read_num);
return transaction_manager->with_transaction_intr(
src,
tname,
+ cache_hint_flags,
[&, this, ch, tname](auto& t)
{
LOG_PREFIX(SeaStoreS::repeat_with_onode);
diff --git a/src/crimson/os/seastore/seastore_types.h b/src/crimson/os/seastore/seastore_types.h
index 335a439dcb5..5930469ca07 100644
--- a/src/crimson/os/seastore/seastore_types.h
+++ b/src/crimson/os/seastore/seastore_types.h
@@ -20,9 +20,42 @@
#include "include/intarith.h"
#include "include/interval_set.h"
#include "include/uuid.h"
+#include "include/rados.h"
namespace crimson::os::seastore {
+class cache_hint_t {
+ enum hint_t {
+ TOUCH,
+ NOCACHE
+ };
+public:
+ static constexpr cache_hint_t get_touch() {
+ return hint_t::TOUCH;
+ }
+ static constexpr cache_hint_t get_nocache() {
+ return hint_t::NOCACHE;
+ }
+ cache_hint_t(uint32_t flags) {
+ if (unlikely(flags & CEPH_OSD_OP_FLAG_FADVISE_DONTNEED) ||
+ unlikely(flags & CEPH_OSD_OP_FLAG_FADVISE_NOCACHE)) {
+ hint = NOCACHE;
+ }
+ }
+ bool operator==(const cache_hint_t &other) const {
+ return hint == other.hint;
+ }
+ bool operator!=(const cache_hint_t &other) const {
+ return hint != other.hint;
+ }
+private:
+ constexpr cache_hint_t(hint_t hint) : hint(hint) {}
+ hint_t hint = hint_t::TOUCH;
+};
+
+inline constexpr cache_hint_t CACHE_HINT_TOUCH = cache_hint_t::get_touch();
+inline constexpr cache_hint_t CACHE_HINT_NOCACHE = cache_hint_t::get_nocache();
+
/* using a special xattr key "omap_header" to store omap header */
const std::string OMAP_HEADER_XATTR_KEY = "omap_header";
diff --git a/src/crimson/os/seastore/transaction.h b/src/crimson/os/seastore/transaction.h
index 66a9f896520..cd8c333c69f 100644
--- a/src/crimson/os/seastore/transaction.h
+++ b/src/crimson/os/seastore/transaction.h
@@ -409,12 +409,14 @@ public:
src_t src,
journal_seq_t initiated_after,
on_destruct_func_t&& f,
- transaction_id_t trans_id
+ transaction_id_t trans_id,
+ cache_hint_t cache_hint
) : weak(weak),
handle(std::move(handle)),
on_destruct(std::move(f)),
src(src),
- trans_id(trans_id)
+ trans_id(trans_id),
+ cache_hint(cache_hint)
{}
void invalidate_clear_write_set() {
@@ -573,6 +575,10 @@ public:
return pre_alloc_list;
}
+ cache_hint_t get_cache_hint() const {
+ return cache_hint;
+ }
+
private:
friend class Cache;
friend Ref make_test_transaction();
@@ -682,6 +688,8 @@ private:
seastar::lw_shared_ptr<rbm_pending_ool_t> pending_ool;
backref_entry_refs_t backref_entries;
+
+ cache_hint_t cache_hint = CACHE_HINT_TOUCH;
};
using TransactionRef = Transaction::Ref;
@@ -694,7 +702,8 @@ inline TransactionRef make_test_transaction() {
Transaction::src_t::MUTATE,
JOURNAL_SEQ_NULL,
[](Transaction&) {},
- ++next_id
+ ++next_id,
+ CACHE_HINT_TOUCH
);
}
diff --git a/src/crimson/os/seastore/transaction_manager.cc b/src/crimson/os/seastore/transaction_manager.cc
index 753bd5d6ff6..807d88b2cbc 100644
--- a/src/crimson/os/seastore/transaction_manager.cc
+++ b/src/crimson/os/seastore/transaction_manager.cc
@@ -66,6 +66,7 @@ TransactionManager::mkfs_ertr::future<> TransactionManager::mkfs()
return with_transaction_intr(
Transaction::src_t::MUTATE,
"mkfs_tm",
+ CACHE_HINT_TOUCH,
[this, FNAME](auto& t)
{
cache->init();
@@ -131,6 +132,7 @@ TransactionManager::mount()
journal->get_trimmer().set_journal_head(start_seq);
return with_transaction_weak(
"mount",
+ CACHE_HINT_TOUCH,
[this](auto &t)
{
return cache->init_cached_extents(t, [this](auto &t, auto &e) {
diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h
index dc6cc20cf59..e574460894a 100644
--- a/src/crimson/os/seastore/transaction_manager.h
+++ b/src/crimson/os/seastore/transaction_manager.h
@@ -741,8 +741,9 @@ public:
TransactionRef create_transaction(
Transaction::src_t src,
const char* name,
+ cache_hint_t cache_hint = CACHE_HINT_TOUCH,
bool is_weak=false) final {
- return cache->create_transaction(src, name, is_weak);
+ return cache->create_transaction(src, name, cache_hint, is_weak);
}
using ExtentCallbackInterface::submit_transaction_direct_ret;
diff --git a/src/crimson/osd/pg_backend.cc b/src/crimson/osd/pg_backend.cc
index a40b28caa8b..79895de06de 100644
--- a/src/crimson/osd/pg_backend.cc
+++ b/src/crimson/osd/pg_backend.cc
@@ -1325,9 +1325,10 @@ maybe_get_omap_vals(
PGBackend::ll_read_ierrorator::future<ceph::bufferlist>
PGBackend::omap_get_header(
const crimson::os::CollectionRef& c,
- const ghobject_t& oid) const
+ const ghobject_t& oid,
+ uint32_t op_flags) const
{
- return store->omap_get_header(c, oid)
+ return store->omap_get_header(c, oid, op_flags)
.handle_error(
crimson::ct_error::enodata::handle([] {
return seastar::make_ready_future<bufferlist>();
@@ -1340,10 +1341,13 @@ PGBackend::ll_read_ierrorator::future<>
PGBackend::omap_get_header(
const ObjectState& os,
OSDOp& osd_op,
- object_stat_sum_t& delta_stats) const
+ object_stat_sum_t& delta_stats,
+ uint32_t op_flags) const
{
if (os.oi.is_omap()) {
- return omap_get_header(coll, ghobject_t{os.oi.soid}).safe_then_interruptible(
+ return omap_get_header(
+ coll, ghobject_t{os.oi.soid}, CEPH_OSD_OP_FLAG_FADVISE_DONTNEED
+ ).safe_then_interruptible(
[&delta_stats, &osd_op] (ceph::bufferlist&& header) {
osd_op.outdata = std::move(header);
delta_stats.num_rd_kb += shift_round_up(osd_op.outdata.length(), 10);
@@ -1707,7 +1711,8 @@ PGBackend::fiemap(
CollectionRef c,
const ghobject_t& oid,
uint64_t off,
- uint64_t len)
+ uint64_t len,
+ uint32_t op_flags)
{
return store->fiemap(c, oid, off, len);
}
diff --git a/src/crimson/osd/pg_backend.h b/src/crimson/osd/pg_backend.h
index c24176a10e7..9c2230375b0 100644
--- a/src/crimson/osd/pg_backend.h
+++ b/src/crimson/osd/pg_backend.h
@@ -315,7 +315,8 @@ public:
CollectionRef c,
const ghobject_t& oid,
uint64_t off,
- uint64_t len);
+ uint64_t len,
+ uint32_t op_flags = 0);
write_iertr::future<> tmapput(
ObjectState& os,
@@ -375,11 +376,13 @@ public:
object_stat_sum_t& delta_stats);
ll_read_ierrorator::future<ceph::bufferlist> omap_get_header(
const crimson::os::CollectionRef& c,
- const ghobject_t& oid) const;
+ const ghobject_t& oid,
+ uint32_t op_flags = 0) const;
ll_read_ierrorator::future<> omap_get_header(
const ObjectState& os,
OSDOp& osd_op,
- object_stat_sum_t& delta_stats) const;
+ object_stat_sum_t& delta_stats,
+ uint32_t op_flags = 0) const;
interruptible_future<> omap_set_header(
ObjectState& os,
const OSDOp& osd_op,
diff --git a/src/crimson/osd/replicated_recovery_backend.cc b/src/crimson/osd/replicated_recovery_backend.cc
index 31f05836b8e..30e7a8a333d 100644
--- a/src/crimson/osd/replicated_recovery_backend.cc
+++ b/src/crimson/osd/replicated_recovery_backend.cc
@@ -571,14 +571,17 @@ ReplicatedRecoveryBackend::read_metadata_for_push_op(
return seastar::make_ready_future<eversion_t>(ver);
}
return interruptor::make_interruptible(interruptor::when_all_succeed(
- backend->omap_get_header(coll, ghobject_t(oid)).handle_error_interruptible<false>(
+ backend->omap_get_header(
+ coll, ghobject_t(oid), CEPH_OSD_OP_FLAG_FADVISE_DONTNEED
+ ).handle_error_interruptible<false>(
crimson::os::FuturizedStore::Shard::read_errorator::all_same_way(
[oid] (const std::error_code& e) {
logger().debug("read_metadata_for_push_op, error {} when getting omap header: {}", e, oid);
return seastar::make_ready_future<bufferlist>();
})),
- interruptor::make_interruptible(store->get_attrs(coll, ghobject_t(oid)))
- .handle_error_interruptible<false>(
+ interruptor::make_interruptible(
+ store->get_attrs(coll, ghobject_t(oid), CEPH_OSD_OP_FLAG_FADVISE_DONTNEED)
+ ).handle_error_interruptible<false>(
crimson::os::FuturizedStore::Shard::get_attrs_ertr::all_same_way(
[oid] (const std::error_code& e) {
logger().debug("read_metadata_for_push_op, error {} when getting attrs: {}", e, oid);
@@ -616,8 +619,14 @@ ReplicatedRecoveryBackend::read_object_for_push_op(
return seastar::make_ready_future<uint64_t>(offset);
}
// 1. get the extents in the interested range
- return interruptor::make_interruptible(backend->fiemap(coll, ghobject_t{oid},
- 0, copy_subset.range_end())).safe_then_interruptible(
+ return interruptor::make_interruptible(
+ backend->fiemap(
+ coll,
+ ghobject_t{oid},
+ 0,
+ copy_subset.range_end(),
+ CEPH_OSD_OP_FLAG_FADVISE_DONTNEED)
+ ).safe_then_interruptible(
[=, this](auto&& fiemap_included) mutable {
interval_set<uint64_t> extents;
try {
@@ -633,8 +642,12 @@ 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 interruptor::make_interruptible(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,
+ CEPH_OSD_OP_FLAG_FADVISE_DONTNEED));
}).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/crimson/tools/store_nbd/tm_driver.cc b/src/crimson/tools/store_nbd/tm_driver.cc
index 389ecd78afc..870809c5153 100644
--- a/src/crimson/tools/store_nbd/tm_driver.cc
+++ b/src/crimson/tools/store_nbd/tm_driver.cc
@@ -25,6 +25,7 @@ seastar::future<> TMDriver::write(
return tm->with_transaction_intr(
Transaction::src_t::MUTATE,
"write",
+ CACHE_HINT_TOUCH,
[this, offset, &ptr](auto& t)
{
return tm->remove(t, laddr_t::from_byte_offset(offset)
@@ -112,6 +113,7 @@ seastar::future<bufferlist> TMDriver::read(
return tm->with_transaction_intr(
Transaction::src_t::READ,
"read",
+ CACHE_HINT_TOUCH,
[=, &blret, this](auto& t)
{
return read_extents(t, laddr_t::from_byte_offset(offset), size
diff --git a/src/test/crimson/seastore/test_btree_lba_manager.cc b/src/test/crimson/seastore/test_btree_lba_manager.cc
index 8b1f7435c87..7874411e0ff 100644
--- a/src/test/crimson/seastore/test_btree_lba_manager.cc
+++ b/src/test/crimson/seastore/test_btree_lba_manager.cc
@@ -157,7 +157,10 @@ struct btree_test_base :
}).safe_then([this] {
return seastar::do_with(
cache->create_transaction(
- Transaction::src_t::MUTATE, "test_set_up_fut", false),
+ Transaction::src_t::MUTATE,
+ "test_set_up_fut",
+ CACHE_HINT_TOUCH,
+ false),
[this](auto &ref_t) {
return with_trans_intr(*ref_t, [&](auto &t) {
cache->init();
@@ -236,7 +239,10 @@ struct lba_btree_test : btree_test_base {
template <typename F>
auto lba_btree_update(F &&f) {
auto tref = cache->create_transaction(
- Transaction::src_t::MUTATE, "test_btree_update", false);
+ Transaction::src_t::MUTATE,
+ "test_btree_update",
+ CACHE_HINT_TOUCH,
+ false);
auto &t = *tref;
with_trans_intr(
t,
@@ -281,7 +287,10 @@ struct lba_btree_test : btree_test_base {
template <typename F>
auto lba_btree_read(F &&f) {
auto t = cache->create_transaction(
- Transaction::src_t::READ, "test_btree_read", false);
+ Transaction::src_t::READ,
+ "test_btree_read",
+ CACHE_HINT_TOUCH,
+ false);
return with_trans_intr(
*t,
[this, f=std::forward<F>(f)](auto &t) mutable {
@@ -429,7 +438,10 @@ struct btree_lba_manager_test : btree_test_base {
auto create_transaction(bool create_fake_extent=true) {
auto t = test_transaction_t{
cache->create_transaction(
- Transaction::src_t::MUTATE, "test_mutate_lba", false),
+ Transaction::src_t::MUTATE,
+ "test_mutate_lba",
+ CACHE_HINT_TOUCH,
+ false),
test_lba_mappings
};
if (create_fake_extent) {
@@ -445,7 +457,10 @@ struct btree_lba_manager_test : btree_test_base {
auto create_weak_transaction() {
auto t = test_transaction_t{
cache->create_transaction(
- Transaction::src_t::READ, "test_read_weak", true),
+ Transaction::src_t::READ,
+ "test_read_weak",
+ CACHE_HINT_TOUCH,
+ true),
test_lba_mappings
};
return t;
diff --git a/src/test/crimson/seastore/test_seastore_cache.cc b/src/test/crimson/seastore/test_seastore_cache.cc
index 6e24f436b98..fa774886139 100644
--- a/src/test/crimson/seastore/test_seastore_cache.cc
+++ b/src/test/crimson/seastore/test_seastore_cache.cc
@@ -87,7 +87,10 @@ struct cache_test_t : public seastar_test_suite_t {
auto get_transaction() {
return cache->create_transaction(
- Transaction::src_t::MUTATE, "test_cache", false);
+ Transaction::src_t::MUTATE,
+ "test_cache",
+ CACHE_HINT_TOUCH,
+ false);
}
template <typename T, typename... Args>