diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2017-06-16 13:20:25 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2017-06-16 17:04:01 +0200 |
commit | 59d646167f8f47fbef3231469675f52d90432205 (patch) | |
tree | 83d90a6e6ba602575d90661f5ee9b8f55aa5be1d /lib/report | |
parent | 529dcaf6a3c4fea4a15baf13cf057d2333860c05 (diff) | |
download | lvm2-59d646167f8f47fbef3231469675f52d90432205.tar.gz |
raid: report percent with segtype info
Enhance reporting code, so it does not need to do 'extra' ioctl to
get 'status' of normal raid and provide percentage directly.
When we have 'merging' snapshot into raid origin, we still need to get
this secondary number with extra status call - however, since 'raid'
is always a single segment LV - we may skip 'copy_percent' call as
we directly know the percent and also with better precision.
NOTE: for mirror we still base reported number on the percetage of
transferred extents which might get quite imprecisse if big size
of extent is used while volume itself is smaller as reporting jump
steps are much bigger the actual reported number provides.
2nd.NOTE: raid lvs line report already requires quite a few extra status
calls for the same device - but fix will be need slight code improval.
Diffstat (limited to 'lib/report')
-rw-r--r-- | lib/report/report.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/report/report.c b/lib/report/report.c index d9880b206..f61776ede 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -3079,11 +3079,13 @@ static int _copypercent_disp(struct dm_report *rh, dm_percent_t percent = DM_PERCENT_INVALID; /* TODO: just cache passes through lvseg_percent... */ - if (lv_is_cache(lv) || lv_is_used_cache_pool(lv)) + if (lv_is_cache(lv) || lv_is_used_cache_pool(lv) || + (!lv_is_merging_origin(lv) && lv_is_raid(lv) && !seg_is_any_raid0(first_seg(lv)))) percent = lvseg_percent_with_info_and_seg_status(lvdm, PERCENT_GET_DIRTY); - else if (((lv_is_raid(lv) && !seg_is_any_raid0(first_seg(lv)) && - lv_raid_percent(lv, &percent)) || - (lv_is_mirror(lv) && + else if (lv_is_raid(lv) && !seg_is_any_raid0(first_seg(lv))) + /* old way for percentage when merging snapshot into raid origin */ + (void) lv_raid_percent(lv, &percent); + else if (((lv_is_mirror(lv) && lv_mirror_percent(lv->vg->cmd, lv, 0, &percent, NULL))) && (percent != DM_PERCENT_INVALID)) percent = copy_percent(lv); |