1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

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.
This commit is contained in:
Jonathan Earl Brassow 2012-02-13 20:13:39 +00:00
parent 96f82296ae
commit ad48a46fc9
4 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.92 - Version 2.02.92 -
==================================== ====================================
Make conversion from a synced 'mirror' to 'raid1' not cause a full resync.
Properly test buffer for unit check in units_to_bytes(). Properly test buffer for unit check in units_to_bytes().
Add configure --with-systemdsystemunitdir. Add configure --with-systemdsystemunitdir.
Add check for allocation failure in _build_matcher(). Add check for allocation failure in _build_matcher().

View File

@ -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 *pvmove_mirror_count __attribute__((unused)))
{ {
uint32_t s; uint32_t s;
uint64_t flags = 0;
uint64_t rebuilds = 0; uint64_t rebuilds = 0;
if (!seg->area_count) { 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) if (seg_lv(seg, s)->status & LV_REBUILD)
rebuilds |= 1 << s; rebuilds |= 1 << s;
if (mirror_in_sync())
flags = DM_NOSYNC;
if (!dm_tree_node_add_raid_target(node, len, _raid_name(seg), if (!dm_tree_node_add_raid_target(node, len, _raid_name(seg),
seg->region_size, seg->stripe_size, seg->region_size, seg->stripe_size,
rebuilds, 0)) rebuilds, flags))
return_0; return_0;
return add_areas_line(dm, seg, node, 0u, seg->area_count); return add_areas_line(dm, seg, node, 0u, seg->area_count);

View File

@ -548,7 +548,7 @@ int dm_tree_node_add_raid_target(struct dm_tree_node *node,
uint32_t region_size, uint32_t region_size,
uint32_t stripe_size, uint32_t stripe_size,
uint64_t rebuilds, uint64_t rebuilds,
uint64_t reserved2); uint64_t flags);
/* /*
* Replicator operation mode * Replicator operation mode

View File

@ -2751,7 +2751,7 @@ int dm_tree_node_add_raid_target(struct dm_tree_node *node,
uint32_t region_size, uint32_t region_size,
uint32_t stripe_size, uint32_t stripe_size,
uint64_t rebuilds, uint64_t rebuilds,
uint64_t reserved2) uint64_t flags)
{ {
int i; int i;
struct load_segment *seg = NULL; struct load_segment *seg = NULL;
@ -2769,6 +2769,7 @@ int dm_tree_node_add_raid_target(struct dm_tree_node *node,
seg->stripe_size = stripe_size; seg->stripe_size = stripe_size;
seg->area_count = 0; seg->area_count = 0;
seg->rebuilds = rebuilds; seg->rebuilds = rebuilds;
seg->flags = flags;
return 1; return 1;
} }