]> sourceware.org Git - lvm2.git/commitdiff
allow a mirror to contain only one mimage
authorAlasdair Kergon <agk@redhat.com>
Wed, 16 Jan 2008 19:18:51 +0000 (19:18 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 16 Jan 2008 19:18:51 +0000 (19:18 +0000)
lib/activate/activate.c
lib/metadata/mirror.c
lib/mirror/mirrored.c

index 30fdaa47529691baa0c8255d49fbb8a23f4eb46e..785d3bb22d182a14f41a9980e06c997cadcd6dd9 100644 (file)
@@ -508,6 +508,13 @@ int lv_mirror_percent(struct cmd_context *cmd, struct logical_volume *lv,
        struct dev_manager *dm;
        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())
                return 0;
 
index be9e7ae789b8b66da46fbc3f6534f34e07ef0058..21e00b9455e24a5d93bc91ddaba3d0caad030c0e 100644 (file)
@@ -956,7 +956,7 @@ float copy_percent(struct logical_volume *lv_mirr)
        list_iterate_items(seg, &lv_mirr->segments) {
                denominator += seg->area_len;
 
-               if (seg_is_mirrored(seg))
+               if (seg_is_mirrored(seg) && seg->area_count > 1)
                        numerator += seg->extents_copied;
                else
                        numerator += seg->area_len;
index 3a3df3316cc9d662d999244067fe015acea466ea..917d0391a621da660dab0185a4ca566b5c04c64a 100644 (file)
@@ -283,6 +283,11 @@ static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem
 
        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.
         * Segments before this are COMPLETED and use 2nd area.
This page took 0.042854 seconds and 5 git commands to generate.