1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-25 21:57:45 +03:00

raid: cleanup error messages

Add log_error messages on error paths.
This commit is contained in:
Zdenek Kabelac 2014-05-27 16:56:33 +02:00
parent ae43d1afa2
commit 9240aca369

View File

@ -544,16 +544,10 @@ static int _raid_add_images(struct logical_volume *lv,
log_error("Unable to add RAID images to %s of segment type %s",
lv->name, seg->segtype->ops->name(seg));
return 0;
} else if (!_raid_in_sync(lv)) {
log_error("Unable to add RAID images until %s is in-sync",
lv->name);
return 0;
}
if (!_alloc_image_components(lv, pvs, count, &meta_lvs, &data_lvs)) {
log_error("Failed to allocate new image components");
return 0;
}
if (!_alloc_image_components(lv, pvs, count, &meta_lvs, &data_lvs))
return_0;
/*
* If linear, we must correct data LV names. They are off-by-one
@ -570,7 +564,7 @@ static int _raid_add_images(struct logical_volume *lv,
dm_list_iterate(l, &data_lvs) {
if (l == dm_list_last(&data_lvs)) {
lvl = dm_list_item(l, struct lv_list);
len = strlen(lv->name) + strlen("_rimage_XXX");
len = strlen(lv->name) + sizeof("_rimage_XXX");
if (!(name = dm_pool_alloc(lv->vg->vgmem, len))) {
log_error("Failed to allocate rimage name.");
return 0;
@ -607,8 +601,7 @@ static int _raid_add_images(struct logical_volume *lv,
log_very_verbose("Setting RAID1 region_size to %uS",
seg->region_size);
}
seg->segtype = get_segtype_from_string(lv->vg->cmd, "raid1");
if (!seg->segtype)
if (!(seg->segtype = get_segtype_from_string(lv->vg->cmd, "raid1")))
return_0;
}
/*
@ -624,15 +617,19 @@ to be left for these sub-lvs.
*/
/* Expand areas array */
if (!(new_areas = dm_pool_zalloc(lv->vg->cmd->mem,
new_count * sizeof(*new_areas))))
new_count * sizeof(*new_areas)))) {
log_error("Allocation of new areas failed.");
goto fail;
}
memcpy(new_areas, seg->areas, seg->area_count * sizeof(*seg->areas));
seg->areas = new_areas;
/* Expand meta_areas array */
if (!(new_areas = dm_pool_zalloc(lv->vg->cmd->mem,
new_count * sizeof(*new_areas))))
new_count * sizeof(*new_areas)))) {
log_error("Allocation of new meta areas failed.");
goto fail;
}
if (seg->meta_areas)
memcpy(new_areas, seg->meta_areas,
seg->area_count * sizeof(*seg->meta_areas));
@ -738,7 +735,7 @@ fail:
dm_list_iterate_items(lvl, &data_lvs)
if (!lv_remove(lvl->lv))
return_0;
return_0;
return 0;
}
/*