Skip to content

Commit c66e46f

Browse files
committed
crimson/os/seastore: introduce and use omaptree_initialize()
Signed-off-by: Yingxin Cheng <[email protected]>
1 parent 5b97e49 commit c66e46f

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

src/crimson/os/seastore/seastore.cc

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,20 @@ SET_SUBSYS(seastore);
7777

7878
namespace crimson::os::seastore {
7979

80+
using crimson::os::seastore::omap_manager::BtreeOMapManager;
81+
82+
static OMapManager::initialize_omap_ret
83+
omaptree_initialize(
84+
Transaction& t,
85+
BtreeOMapManager& mgr,
86+
omap_type_t type,
87+
Onode& onode,
88+
Device& device)
89+
{
90+
return mgr.initialize_omap(
91+
t, onode.get_metadata_hint(device.get_block_size()), type);
92+
}
93+
8094
class FileMDStore final : public SeaStore::MDStore {
8195
std::string root;
8296
public:
@@ -1213,8 +1227,6 @@ SeaStore::Shard::readv(
12131227
});
12141228
}
12151229

1216-
using crimson::os::seastore::omap_manager::BtreeOMapManager;
1217-
12181230
SeaStore::Shard::omaptree_get_value_ret
12191231
SeaStore::Shard::_get_attr(
12201232
Transaction& t,
@@ -1828,19 +1840,18 @@ SeaStore::Shard::_do_transaction_step(
18281840
}
18291841
case Transaction::OP_SETALLOCHINT:
18301842
{
1843+
// TODO
18311844
DEBUGT("op SETALLOCHINT, oid={}, not implemented",
18321845
*ctx.transaction, oid);
1833-
// TODO
18341846
if (op->hint & CEPH_OSD_ALLOC_HINT_FLAG_LOG) {
18351847
ceph_assert(get_omap_root(omap_type_t::LOG, *onode).is_null());
18361848
ceph_assert(get_omap_root(omap_type_t::OMAP, *onode).is_null());
1837-
return BtreeOMapManager(*transaction_manager).initialize_omap(
1838-
*ctx.transaction, onode->get_metadata_hint(device->get_block_size()),
1839-
omap_type_t::LOG
1849+
// BtreeOMapManager doesn't need a do_with yet.
1850+
auto mgr = BtreeOMapManager(*transaction_manager);
1851+
return omaptree_initialize(
1852+
*ctx.transaction, mgr, omap_type_t::LOG, *onode, *device
18401853
).si_then([&onode, &ctx](auto new_root) {
1841-
if (new_root.must_update()) {
1842-
onode->update_log_root(*ctx.transaction, new_root);
1843-
}
1854+
onode->update_log_root(*ctx.transaction, new_root);
18441855
});
18451856
}
18461857
return tm_iertr::now();
@@ -2756,11 +2767,9 @@ SeaStore::Shard::omaptree_set_keys(
27562767
assert(root.get_type() < omap_type_t::NONE);
27572768
base_iertr::future<> maybe_create_root = base_iertr::now();
27582769
if (root.is_null()) {
2759-
maybe_create_root = omap_manager.initialize_omap(t,
2760-
onode.get_metadata_hint(device->get_block_size()),
2761-
root.get_type()
2770+
maybe_create_root = omaptree_initialize(
2771+
t, omap_manager, root.get_type(), onode, *device
27622772
).si_then([&root](auto new_root) {
2763-
assert(new_root.get_type() == root.get_type());
27642773
root = new_root;
27652774
});
27662775
}

0 commit comments

Comments
 (0)