From: Yingxin Cheng Date: Wed, 11 Dec 2024 07:19:57 +0000 (+0800) Subject: crimson/os/seastore: unify Transaction& parameter for omap X-Git-Tag: v20.3.0~347^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6008796799ff72cd6d7938ef83297653d0713b87;p=ceph.git crimson/os/seastore: unify Transaction& parameter for omap Signed-off-by: Yingxin Cheng Signed-off-by: Myoungwon Oh --- diff --git a/src/crimson/os/seastore/seastore.cc b/src/crimson/os/seastore/seastore.cc index 7be7cbe45f0a..7b05aed74889 100644 --- a/src/crimson/os/seastore/seastore.cc +++ b/src/crimson/os/seastore/seastore.cc @@ -1892,7 +1892,7 @@ SeaStore::Shard::_do_transaction_step( DEBUGT("op OMAP_SETKEYS, oid={}, omap size={}, type={} ...", *ctx.transaction, oid, aset.size(), root.get_type()); return _omap_set_values( - ctx, + *ctx.transaction, onode, std::move(aset), std::move(root)); @@ -1914,7 +1914,7 @@ SeaStore::Shard::_do_transaction_step( DEBUGT("op OMAP_RMKEYS, oid={}, omap size={}, type={} ...", *ctx.transaction, oid, keys.size(), root.get_type()); return _omap_rmkeys( - ctx, + *ctx.transaction, onode, std::move(keys), std::move(root)); @@ -1929,7 +1929,7 @@ SeaStore::Shard::_do_transaction_step( DEBUGT("op OMAP_RMKEYRANGE, oid={}, first={}, last={}, type={}...", *ctx.transaction, oid, first, last, root.get_type()); return _omap_rmkeyrange( - ctx, + *ctx.transaction, onode, std::move(first), std::move(last), std::move(root)); @@ -2206,20 +2206,20 @@ SeaStore::Shard::_write( SeaStore::Shard::tm_ret SeaStore::Shard::_clone_omaps( - internal_context_t &ctx, + Transaction& t, OnodeRef &onode, OnodeRef &d_onode, const omap_type_t type) { - return trans_intr::repeat([&ctx, &onode, &d_onode, this, type] { + return trans_intr::repeat([&t, &onode, &d_onode, this, type] { return seastar::do_with( std::optional(std::nullopt), - [&ctx, &onode, &d_onode, this, type](auto &start) + [&t, &onode, &d_onode, this, type](auto &start) { auto config = OMapManager::omap_list_config_t() .with_inclusive(false, false); - return omap_list(*onode, get_omap_root(type, *onode), *ctx.transaction, start, config - ).si_then([&ctx, &onode, &d_onode, this, type, &start](auto p) { + return omap_list(*onode, get_omap_root(type, *onode), t, start, config + ).si_then([&t, &onode, &d_onode, this, type, &start](auto p) { auto complete = std::get<0>(p); auto &attrs = std::get<1>(p); if (attrs.empty()) { @@ -2230,7 +2230,7 @@ SeaStore::Shard::_clone_omaps( } std::string nstart = attrs.rbegin()->first; return _omap_set_values( - ctx, + t, d_onode, std::map(attrs.begin(), attrs.end()), get_omap_root(type, *d_onode) @@ -2271,13 +2271,13 @@ SeaStore::Shard::_clone( d_onode.get()}); }).si_then([&ctx, &onode, &d_onode, this] { return _clone_omaps( - ctx, onode, d_onode, omap_type_t::XATTR); + *ctx.transaction, onode, d_onode, omap_type_t::XATTR); }).si_then([&ctx, &onode, &d_onode, this] { return _clone_omaps( - ctx, onode, d_onode, omap_type_t::OMAP); + *ctx.transaction, onode, d_onode, omap_type_t::OMAP); }).si_then([&ctx, &onode, &d_onode, this] { return _clone_omaps( - ctx, onode, d_onode, omap_type_t::LOG); + *ctx.transaction, onode, d_onode, omap_type_t::LOG); }); } @@ -2314,12 +2314,11 @@ SeaStore::Shard::_zero( SeaStore::Shard::tm_ret SeaStore::Shard::_omap_set_values( - internal_context_t &ctx, + Transaction& t, OnodeRef &onode, std::map &&kvs, omap_root_t&& root) { - Transaction& t = *ctx.transaction; return seastar::do_with( BtreeOMapManager(*transaction_manager), std::move(root), @@ -2367,7 +2366,7 @@ SeaStore::Shard::_omap_clear( OnodeRef &onode) { return _xattr_rmattr( - ctx, + *ctx.transaction, get_omap_root(omap_type_t::XATTR, *onode), onode, std::string(OMAP_HEADER_XATTR_KEY) @@ -2381,7 +2380,7 @@ SeaStore::Shard::_omap_clear( SeaStore::Shard::tm_ret SeaStore::Shard::_omap_rmkeys( - internal_context_t &ctx, + Transaction &t, OnodeRef &onode, omap_keys_t &&keys, omap_root_t&& root) @@ -2393,18 +2392,18 @@ SeaStore::Shard::_omap_rmkeys( BtreeOMapManager(*transaction_manager), std::move(root), std::move(keys), - [&ctx, &onode] + [&t, &onode] (auto &omap_manager, auto &root, auto &keys) { return trans_intr::do_for_each( keys.begin(), keys.end(), - [&omap_manager, &ctx, &root](auto &p) + [&omap_manager, &t, &root](auto &p) { - return omap_manager.omap_rm_key(root, *ctx.transaction, p); - }).si_then([&ctx, &root, &onode] { + return omap_manager.omap_rm_key(root, t, p); + }).si_then([&t, &root, &onode] { if (root.must_update()) { - omaptree_update_root(*ctx.transaction, root, *onode); + omaptree_update_root(t, root, *onode); } }); }); @@ -2412,7 +2411,7 @@ SeaStore::Shard::_omap_rmkeys( SeaStore::Shard::tm_ret SeaStore::Shard::_omap_rmkeyrange( - internal_context_t &ctx, + Transaction& t, OnodeRef &onode, std::string first, std::string last, @@ -2420,7 +2419,7 @@ SeaStore::Shard::_omap_rmkeyrange( { if (first > last) { LOG_PREFIX(SeaStoreS::_omap_rmkeyrange); - ERRORT("range error, first:{} > last:{}", *ctx.transaction, first, last); + ERRORT("range error, first:{} > last:{}", t, first, last); ceph_abort(); } if (root.is_null()) { @@ -2431,17 +2430,17 @@ SeaStore::Shard::_omap_rmkeyrange( std::move(root), std::move(first), std::move(last), - [&ctx, &onode] + [&t, &onode] (auto &omap_manager, auto &root, auto &first, auto &last) { auto config = OMapManager::omap_list_config_t() .with_inclusive(true, false) .without_max(); return omap_manager.omap_rm_key_range( - root, *ctx.transaction, first, last, config - ).si_then([&ctx, &root, &onode] { + root, t, first, last, config + ).si_then([&t, &root, &onode] { if (root.must_update()) { - omaptree_update_root(*ctx.transaction, root, *onode); + omaptree_update_root(t, root, *onode); } }); }); @@ -2484,7 +2483,7 @@ SeaStore::Shard::_setattrs( // if oi was not in the layout, it probably exists in the omap, // need to remove it first fut = _xattr_rmattr( - ctx, + *ctx.transaction, get_omap_root(omap_type_t::XATTR, *onode), onode, OI_ATTR); @@ -2503,7 +2502,7 @@ SeaStore::Shard::_setattrs( if (!layout.ss_size) { fut = _xattr_rmattr( - ctx, + *ctx.transaction, get_omap_root(omap_type_t::XATTR, *onode), onode, SS_ATTR); @@ -2525,7 +2524,7 @@ SeaStore::Shard::_setattrs( return std::move(fut ).si_then([this, onode, &ctx, aset=std::move(aset)]() mutable { return _omap_set_values( - ctx, + *ctx.transaction, onode, std::move(aset), get_omap_root(omap_type_t::XATTR, *onode)); @@ -2547,7 +2546,7 @@ SeaStore::Shard::_rmattr( return tm_iertr::now(); } else { return _xattr_rmattr( - ctx, + *ctx.transaction, get_omap_root(omap_type_t::XATTR, *onode), onode, std::move(name)); @@ -2556,13 +2555,13 @@ SeaStore::Shard::_rmattr( SeaStore::Shard::tm_ret SeaStore::Shard::_xattr_rmattr( - internal_context_t &ctx, + Transaction& t, omap_root_t&& root, OnodeRef &onode, std::string &&name) { LOG_PREFIX(SeaStoreS::_xattr_rmattr); - DEBUGT("onode={}", *ctx.transaction, *onode); + DEBUGT("onode={}", t, *onode); if (root.is_null()) { return base_iertr::now(); } @@ -2570,12 +2569,12 @@ SeaStore::Shard::_xattr_rmattr( BtreeOMapManager(*transaction_manager), std::move(root), std::move(name), - [&ctx, &onode](auto &omap_manager, auto &root, auto &name) + [&t, &onode](auto &omap_manager, auto &root, auto &name) { - return omap_manager.omap_rm_key(root, *ctx.transaction, name - ).si_then([&ctx, &root, &onode] { + return omap_manager.omap_rm_key(root, t, name + ).si_then([&t, &root, &onode] { if (root.must_update()) { - omaptree_update_root(*ctx.transaction, root, *onode); + omaptree_update_root(t, root, *onode); } }); }); diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h index 2feb4f556c50..f85c3befa8bd 100644 --- a/src/crimson/os/seastore/seastore.h +++ b/src/crimson/os/seastore/seastore.h @@ -427,7 +427,7 @@ public: ceph::bufferlist &&bl, uint32_t fadvise_flags); tm_ret _clone_omaps( - internal_context_t &ctx, + Transaction &t, OnodeRef &onode, OnodeRef &d_onode, const omap_type_t otype); @@ -444,7 +444,7 @@ public: OnodeRef &onode, objaddr_t offset, extent_len_t len); tm_ret _omap_set_values( - internal_context_t &ctx, + Transaction &t, OnodeRef &onode, std::map &&aset, omap_root_t&& omap_root); @@ -456,12 +456,12 @@ public: internal_context_t &ctx, OnodeRef &onode); tm_ret _omap_rmkeys( - internal_context_t &ctx, + Transaction &t, OnodeRef &onode, omap_keys_t &&aset, omap_root_t &&_omap_root); tm_ret _omap_rmkeyrange( - internal_context_t &ctx, + Transaction &t, OnodeRef &onode, std::string first, std::string last, @@ -481,7 +481,7 @@ public: internal_context_t &ctx, OnodeRef &onode); tm_ret _xattr_rmattr( - internal_context_t &ctx, + Transaction &t, omap_root_t&& root, OnodeRef &onode, std::string &&name);