Skip to content

Commit af393e4

Browse files
committed
crimson/os/seastore/cache: init root as dirty
To simplify checks that root won't appear in lru. Also, make sure root has a root paddr. Signed-off-by: Yingxin Cheng <[email protected]>
1 parent 7b889ea commit af393e4

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/crimson/os/seastore/cache.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,10 +1302,11 @@ record_t Cache::prepare_record(
13021302
t, delta_length, *i);
13031303
assert(t.root == i);
13041304
root = t.root;
1305+
assert(root->get_paddr().is_root());
13051306
record.push_back(
13061307
delta_info_t{
13071308
extent_types_t::ROOT,
1308-
P_ADDR_NULL,
1309+
P_ADDR_ROOT,
13091310
L_ADDR_NULL,
13101311
0,
13111312
0,
@@ -1886,13 +1887,16 @@ void Cache::init()
18861887
root = nullptr;
18871888
}
18881889
root = CachedExtent::make_cached_extent_ref<RootBlock>();
1889-
root->init(CachedExtent::extent_state_t::CLEAN,
1890+
// Make it simpler to keep root dirty
1891+
root->init(CachedExtent::extent_state_t::DIRTY,
18901892
P_ADDR_ROOT,
18911893
PLACEMENT_HINT_NULL,
18921894
NULL_GENERATION,
1893-
TRANS_ID_NULL);
1895+
TRANS_ID_NULL);
1896+
root->set_modify_time(seastar::lowres_system_clock::now());
18941897
INFO("init root -- {}", *root);
1895-
extents_index.insert(*root);
1898+
add_extent(root);
1899+
add_to_dirty(root, nullptr);
18961900
}
18971901

18981902
Cache::mkfs_iertr::future<> Cache::mkfs(Transaction &t)

0 commit comments

Comments
 (0)