1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

Additional fixes for lv_mirror_count.

Changing lv_mirror_count to only count the AREA_LVs made the function
stop working for PVMOVE mirrors.  A conditional has been added to fix
that problem.  Additionally, when counting the images in a mirror stack,
we don't need to subtract 1 from the count we get back from the
lv_mirror_count call on the temporary mirror layer.  (This is because we
are no falsely counting the top layer of the temporary mirror.)
This commit is contained in:
Jonathan Earl Brassow 2011-09-14 04:10:26 +00:00
parent 9cb27929e9
commit 462579d54e

View File

@ -114,13 +114,17 @@ uint32_t lv_mirror_count(const struct logical_volume *lv)
return 1;
seg = first_seg(lv);
if (lv->status & PVMOVE)
return seg->area_count;
mirrors = 0;
for (s = 0; s < seg->area_count; s++) {
if (seg_type(seg, s) != AREA_LV)
continue;
if (is_temporary_mirror_layer(seg_lv(seg, s)))
mirrors += lv_mirror_count(seg_lv(seg, s)) - 1;
mirrors += lv_mirror_count(seg_lv(seg, s));
else
mirrors++;
}