mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
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.
This commit is contained in:
parent
529dcaf6a3
commit
59d646167f
@ -1,5 +1,6 @@
|
||||
Version 2.02.172 -
|
||||
===============================
|
||||
Improve raid status reporting with lvs.
|
||||
No longer necessary to '--force' a repair for RAID1
|
||||
Linear to RAID1 upconverts now use "recover" sync action, not "resync".
|
||||
Improve lvcreate --cachepool arg validation.
|
||||
|
@ -395,6 +395,15 @@ dm_percent_t lvseg_percent_with_info_and_seg_status(const struct lv_with_info_an
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SEG_STATUS_RAID:
|
||||
switch (type) {
|
||||
case PERCENT_GET_DIRTY:
|
||||
p = dm_make_percent(s->raid->insync_regions, s->raid->total_regions);
|
||||
break;
|
||||
default:
|
||||
p = DM_PERCENT_INVALID;
|
||||
}
|
||||
break;
|
||||
case SEG_STATUS_SNAPSHOT:
|
||||
if (s->snapshot->merge_failed)
|
||||
p = DM_PERCENT_INVALID;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user