From ad48a46fc9df2ad75510a975c5b15535fc7da825 Mon Sep 17 00:00:00 2001 From: Jonathan Earl Brassow Date: Mon, 13 Feb 2012 20:13:39 +0000 Subject: Make conversion from a synced 'mirror' to 'raid1' not cause a full resync. It was not possible to pass down the DM_[FORCE|NO]SYNC flags to 'dm_tree_node_add_raid_target'. This meant that converting to 'raid1' from 'mirror' would cause a full resync. (It also meant that '--nosync' was ineffective when creating a 'raid1' LV.) I've taken the 'reserved' parameter in 'dm_tree_node_add_raid_target' and used it for the "flags" parameter. Now it is possible to pass the sync flags and any other flags that may come up. --- lib/raid/raid.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/raid/raid.c') diff --git a/lib/raid/raid.c b/lib/raid/raid.c index 3656dada..211f8070 100644 --- a/lib/raid/raid.c +++ b/lib/raid/raid.c @@ -159,6 +159,7 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)), uint32_t *pvmove_mirror_count __attribute__((unused))) { uint32_t s; + uint64_t flags = 0; uint64_t rebuilds = 0; if (!seg->area_count) { @@ -186,9 +187,12 @@ static int _raid_add_target_line(struct dev_manager *dm __attribute__((unused)), if (seg_lv(seg, s)->status & LV_REBUILD) rebuilds |= 1 << s; + if (mirror_in_sync()) + flags = DM_NOSYNC; + if (!dm_tree_node_add_raid_target(node, len, _raid_name(seg), seg->region_size, seg->stripe_size, - rebuilds, 0)) + rebuilds, flags)) return_0; return add_areas_line(dm, seg, node, 0u, seg->area_count); -- cgit