1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

allow a mirror to contain only one mimage

This commit is contained in:
Alasdair Kergon 2008-01-16 19:18:51 +00:00
parent c014417c46
commit 876003dc44
3 changed files with 13 additions and 1 deletions

View File

@ -508,6 +508,13 @@ int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv,
struct dev_manager *dm; struct dev_manager *dm;
struct lvinfo info; struct lvinfo info;
/* If mirrored LV is temporarily shrinked to 1 area (= linear),
* it should be considered in-sync. */
if (list_size(&lv->segments) == 1 && first_seg(lv)->area_count == 1) {
*percent = 100.0;
return 1;
}
if (!activation()) if (!activation())
return 0; return 0;

View File

@ -956,7 +956,7 @@ float copy_percent(struct logical_volume *lv_mirr)
list_iterate_items(seg, &lv_mirr->segments) { list_iterate_items(seg, &lv_mirr->segments) {
denominator += seg->area_len; denominator += seg->area_len;
if (seg_is_mirrored(seg)) if (seg_is_mirrored(seg) && seg->area_count > 1)
numerator += seg->extents_copied; numerator += seg->extents_copied;
else else
numerator += seg->area_len; numerator += seg->area_len;

View File

@ -283,6 +283,11 @@ static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem
mirr_state = *target_state; mirr_state = *target_state;
/* Mirror segment could have only 1 area temporarily,
* if the segment is under conversion. */
if (seg->area_count == 1)
mirror_status = MIRR_DISABLED;
/* /*
* For pvmove, only have one mirror segment RUNNING at once. * For pvmove, only have one mirror segment RUNNING at once.
* Segments before this are COMPLETED and use 2nd area. * Segments before this are COMPLETED and use 2nd area.