1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dev_manager: relocate code

Use better place to search for cvol subdev mappings.
Add them with cachevol that is used for cache LV.
This commit is contained in:
Zdenek Kabelac 2024-03-21 16:12:06 +01:00
parent abc1b44d8d
commit ad582da3ca

View File

@ -2744,13 +2744,6 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
/* Unused cache pool is activated as metadata */
}
if (lv_is_cache(lv) && (plv = (first_seg(lv)->pool_lv)) && lv_is_cache_vol(plv)) {
if (!_add_cvol_subdev_to_dtree(dm, dtree, lv, 0) ||
!_add_cvol_subdev_to_dtree(dm, dtree, lv, 1) ||
!_add_dev_to_dtree(dm, dtree, plv, lv_layer(plv)))
return_0;
}
if (!origin_only && !_add_dev_to_dtree(dm, dtree, lv, NULL))
return_0;
@ -2851,6 +2844,15 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
}
}
if (lv_is_cache_vol(lv))
/* Cachevol with cache LV spans some extra layers -cdata, -cmeta */
dm_list_iterate_items(sl, &lv->segs_using_this_lv)
if (lv_is_cache(sl->seg->lv) &&
(!_add_cvol_subdev_to_dtree(dm, dtree, sl->seg->lv, 0) ||
!_add_cvol_subdev_to_dtree(dm, dtree, sl->seg->lv, 1) ||
!_add_dev_to_dtree(dm, dtree, lv, lv_layer(lv))))
return_0;
/* Add any snapshots of this LV */
if (!origin_only && lv_is_origin(lv))
dm_list_iterate(snh, &lv->snapshot_segs)