if (seg_is_raid0_meta(seg) &&
!seg->meta_areas)
raid_seg_error("no meta areas");
+ if (!seg_is_raid0_meta(seg) &&
+ seg->meta_areas)
+ raid_seg_error("meta areas");
if (!seg->stripe_size)
raid_seg_error("zero stripe size");
if (!is_power_of_2(seg->stripe_size))
/* Check for any MetaLV flaws like non-existing ones or size variations */
if (seg->meta_areas)
for (area_len = s = 0; s < seg->area_count; s++) {
- if (seg_metatype(seg, s) != AREA_LV)
+ if (seg_metatype(seg, s) != AREA_LV) {
raid_seg_error("no MetaLV");
+ continue;
+ }
if (!lv_is_raid_metadata(seg_metalv(seg, s)))
raid_seg_error("MetaLV without RAID metadata flag");
if (area_len &&
*/
static int _alloc_rmeta_devs_for_lv(struct logical_volume *lv,
struct dm_list *meta_lvs,
- struct dm_list *allocate_pvs)
+ struct dm_list *allocate_pvs,
+ struct lv_segment_area **seg_meta_areas)
{
uint32_t s;
struct lv_list *lvl_array;
dm_list_init(&data_lvs);
- if (!(seg->meta_areas = dm_pool_zalloc(lv->vg->vgmem, seg->area_count * sizeof(*seg->meta_areas))))
+ if (!(*seg_meta_areas = dm_pool_zalloc(lv->vg->vgmem, seg->area_count * sizeof(*seg->meta_areas))))
return 0;
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem, seg->area_count * sizeof(*lvl_array))))
{
struct lv_segment *seg = first_seg(lv);
struct dm_list meta_lvs;
+ struct lv_segment_area *seg_meta_areas;
dm_list_init(&meta_lvs);
log_debug_metadata("Allocating metadata LVs for %s", display_lvname(lv));
- if (!_alloc_rmeta_devs_for_lv(lv, &meta_lvs, allocate_pvs)) {
+ if (!_alloc_rmeta_devs_for_lv(lv, &meta_lvs, allocate_pvs, &seg_meta_areas)) {
log_error("Failed to allocate metadata LVs for %s", display_lvname(lv));
return_0;
}
}
/* Set segment areas for metadata sub_lvs */
+ seg->meta_areas = seg_meta_areas;
log_debug_metadata("Adding newly allocated metadata LVs to %s", display_lvname(lv));
if (!_add_image_component_list(seg, 1, 0, &meta_lvs, 0)) {
log_error("Failed to add newly allocated metadata LVs to %s", display_lvname(lv));