master - cleanup: simplify _extract_image_components
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ab7977de7b0c3d4586c40eca0179fbae24bc23ba Commit: ab7977de7b0c3d4586c40eca0179fbae24bc23ba Parent: 68981310916114e8659bb7754c5847a178aaea5d Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Sep 11 22:55:12 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Fri Sep 12 13:51:31 2014 +0200
cleanup: simplify _extract_image_components
Reorder test - first check for writable flag and then allocate.
--- lib/metadata/raid_manip.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-)
lib/metadata/raid_manip.c +7 -8
@@ -1261,8 +1261,13 @@ int lv_raid_merge(struct logical_volume *image_lv)struct lv_segment *seg;struct volume_group *vg = image_lv->vg; - lv_name =dm_pool_strdup (vg->vgmem, image_lv->name); -if (!lv_name) +if (image_lv->status &LVM_WRITE ) { +log_error ("%s is not read-only - refusing to merge." , +display_lvname (image_lv)); +return 0 ; + } + +if (!(lv_name =dm_pool_strdup (vg->vgmem, image_lv->name))) return_0;if (!(p =strstr (lv_name,"_rimage_" ))) {
@@ -1272,12 +1277,6 @@ int lv_raid_merge(struct logical_volume *image_lv) } *p ='\0' ;/* lv_name is now that of top-level RAID */ -if (image_lv->status &LVM_WRITE ) { -log_error ("%s/%s is not read-only - refusing to merge" , - vg->name, image_lv->name); -return 0 ; - } -if (!(lvl =find_lv_in_vg (vg, lv_name))) {log_error ("Unable to find containing RAID array for %s." ,display_lvname (image_lv));