File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -1155,10 +1155,13 @@ CachedExtentRef Cache::duplicate_for_write(
11551155 LOG_PREFIX (Cache::duplicate_for_write);
11561156 assert (i->is_fully_loaded ());
11571157
1158- if (i->is_mutable ())
1158+ if (i->is_mutable ()) {
11591159 return i;
1160+ }
11601161
11611162 if (i->is_exist_clean ()) {
1163+ assert (i->is_logical ());
1164+ assert (static_cast <LogicalCachedExtent&>(*i).has_laddr ());
11621165 i->version ++;
11631166 i->state = CachedExtent::extent_state_t ::EXIST_MUTATION_PENDING;
11641167 i->last_committed_crc = i->calc_crc32c ();
@@ -1189,6 +1192,12 @@ CachedExtentRef Cache::duplicate_for_write(
11891192
11901193 ret->version ++;
11911194 ret->state = CachedExtent::extent_state_t ::MUTATION_PENDING;
1195+ if (i->is_logical ()) {
1196+ auto & lextent = static_cast <LogicalCachedExtent&>(*i);
1197+ assert (lextent.has_laddr ());
1198+ assert (ret->is_logical ());
1199+ static_cast <LogicalCachedExtent&>(*ret).set_laddr (lextent.get_laddr ());
1200+ }
11921201 DEBUGT (" {} -> {}" , t, *i, *ret);
11931202 return ret;
11941203}
Original file line number Diff line number Diff line change @@ -322,18 +322,7 @@ class TransactionManager : public ExtentCallbackInterface {
322322
323323 // / Obtain mutable copy of extent
324324 LogicalChildNodeRef get_mutable_extent (Transaction &t, LogicalChildNodeRef ref) {
325- LOG_PREFIX (TransactionManager::get_mutable_extent);
326- auto ret = cache->duplicate_for_write (
327- t,
328- ref)->cast <LogicalChildNode>();
329- if (!ret->has_laddr ()) {
330- SUBDEBUGT (seastore_tm, " duplicate from {}" , t, *ref);
331- ret->set_laddr (ref->get_laddr ());
332- } else {
333- assert (ref->is_mutable ());
334- assert (&*ref == &*ret);
335- }
336- return ret;
325+ return cache->duplicate_for_write (t, ref)->cast <LogicalChildNode>();
337326 }
338327
339328 using ref_iertr = LBAManager::ref_iertr;
You can’t perform that action at this time.
0 commit comments