From 82a46ed62cd998d9558168fa0875bbbf5a5fc9e0 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 28 Oct 2011 20:23:24 +0000 Subject: [PATCH] Improve lv_extend stack reporting and some code cleanup with setting return value. --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index ea3c0d303..dc47f27c9 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Improve lv_extend stack reporting. Increase virtual segment size instead of creating multiple segment list. Add last_seg(lv) internal function. Support empty string for log/prefix. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 1c00d6c9a..1ea874d6b 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -2571,10 +2571,11 @@ int lv_extend(struct logical_volume *lv, if (segtype_is_thin_pool(segtype)) { if (!(r = extend_pool(lv, segtype, ah))) stack; - } else if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype)) - r = lv_add_segment(ah, 0, ah->area_count, lv, segtype, - stripe_size, 0u, 0); - else { + } else if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype)) { + if (!(r = lv_add_segment(ah, 0, ah->area_count, lv, segtype, + stripe_size, 0u, 0))) + stack; + } else { /* * For RAID, all the devices are AREA_LV. * However, for 'mirror on stripe' using non-RAID targets, @@ -2587,11 +2588,10 @@ int lv_extend(struct logical_volume *lv, sub_lv_count = mirrors; if (!lv->le_count && - !_lv_insert_empty_sublvs(lv, segtype, stripe_size, - region_size, sub_lv_count)) { + !(r = _lv_insert_empty_sublvs(lv, segtype, stripe_size, + region_size, sub_lv_count))) { log_error("Failed to insert layer for %s", lv->name); - alloc_destroy(ah); - return 0; + goto out; } if (!(r = _lv_extend_layered_lv(ah, lv, extents, 0, @@ -2620,9 +2620,8 @@ int lv_extend(struct logical_volume *lv, goto out; } - r = 0; - if (!lv_mirror_percent(lv->vg->cmd, lv, 0, - &sync_percent, NULL)) { + if (!(r = lv_mirror_percent(lv->vg->cmd, lv, 0, + &sync_percent, NULL))) { log_error("Failed to get sync percent for %s/%s", lv->vg->name, lv->name); goto out; @@ -2638,7 +2637,6 @@ int lv_extend(struct logical_volume *lv, lv->vg->name, lv->name); goto out; } - r = 1; } } -- 2.43.5