Skip to contentSkip to conversation

Stacking and collapsing mirror (rev. 2)

PATCH New Jun'ichi Nomura 1 participant 14 messages Dec 20, 2007

lore
Share & tools
lore
#0 lore raw

cover Stacking and collapsing mirror (rev. 2)

This set of patches allows mirror addition to mirrored LV.

The patchset is an updated version of this one:
[PATCH mirror 0/13] Add/collapse temporary mirror
https://www.redhat.com/archives/lvm-devel/2007-November/msg00040.html

Changes:
- rebased to the CVS head, which contains most of the latest pvmove/lvconvert patchset

[ 1/13] Add 'const' for mirror-related functions
[ 2/13] Misc fixes to the 'lvconvert' generalization
[ 3/13] Enable layer specification in remove_layer_from_lv() [ 4/13] lv_rename() to walk down the stacked LV
[ 5/13] lv_mirror_count() to cope with stacked mirror
[ 6/13] remove_mirror_images() to cope with stacked mirror [ 7/13] lv_extend() to cope with stacked mirror
[ 8/13] lvconvert to stack a temporary resync mirror on addition [ 9/13] Add collapsing feature for stacked mirror [10/13] Add '--collapse' option to lvconvert
[11/13] Add 'lv_mirrors' field to reporting functions [12/13] Remove hardcoded "_mlog" name from deptree construction [13/13] Allow disk logs for temporary resync mirror

Comments are welcome.

Overview of the patches
--------------------------

Current LVM2 mirror doesn't allow mirror addition to already mirrored LV.
It's not possible to simply add mirror image to the existing LV because it will result in full resync even if existing images are already in sync.

With this patchset, a temporary mirror layer is inserted.

For example, if we have the mirrored LV below:
testvg-lvol0
|-testvg-lvol0_mimage_1
|-testvg-lvol0_mimage_0
`-testvg-lvol0_mlog0

'lvconvert -m+1' will result in this:
testvg-lvol0

   |-testvg-lvol0_mimage_2
   |-testvg-lvol0_resync0
   |  |-testvg-lvol0_mimage_1
   |  |-testvg-lvol0_mimage_0
   |  `-testvg-lvol0_mlog0

`-testvg-lvol0_mlog1

"resync0" is a temporary layer to resync "mimage_2".

'lvs -o mirrors testvg/lvol0' will show "3" as a number of mirror images.

After the resync completes, 'lvconvert --collapse testvg/lvol0' will change the LV to this form:
testvg-lvol0

   |-testvg-lvol0_mimage_2
   |-testvg-lvol0_mimage_1
   |-testvg-lvol0_mimage_0

`-testvg-lvol0_mlog0

Thanks,

Signature · 1 line
Jun'ichi Nomura, NEC Corporation of America
#1 lore raw

PATCH 1/13 Add 'const' for mirror-related functions

Some mirror-related functions should use 'const'.
It will save warnings when we use lv_mirror_count() from reporting function.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: const-mirror.patch
Type: text/x-patch
Size: 3316 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/e5c1e5df/attachment.bin>
#2 lore raw

PATCH 2/13 Misc fixes to the 'lvconvert' generalization

In reply to Jun'ichi Nomura

This small patch contains misc fixes to the lvconvert generalization code that has been just committed to CVS.

- lv_add_mirror_lvs() should turn off VISIBLE_LV flag of each mimage LV.
- 'struct alloc_handle' declaration in metadata-exported.h is not needed as create_mirror_layers() was removed.
- lv_remove_mirrors() should use lv_mirror_count() instead of

    seg->area_count.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-lv_add_mirror-fixups.patch
Type: text/x-patch
Size: 2042 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/168c4546/attachment.bin>
#3 lore raw

PATCH 3/13 Enable layer specification in remove_layer_from_lv()

In reply to Jun'ichi Nomura

Added layer_lv argument to remove_layer_from_lv().

remove_layer_from_lv() has implicitly removed the top-most layer. It won't work if the layer can be stacked.
The caller knows which layer it wants to remove.

find_parent_for_layer() will help find a parent LV for specified layer LV.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-add-layer-spec-to-remove_layer_from_lv.patch
Type: text/x-patch
Size: 3914 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/371afea4/attachment.bin>
#4 lore raw

PATCH 4/13 lv_rename() to walk down the stacked LV

In reply to Jun'ichi Nomura

_for_each_sub_lv() is used by lv_rename() to rename the underlying LVs. But it currently handles only 1 layer. Let it work recursively for more stacked LV.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-lv-rename.patch
Type: text/x-patch
Size: 802 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/ae173ca6/attachment.bin>
#5 lore raw

PATCH 5/13 lv_mirror_count() to cope with stacked mirror

In reply to Jun'ichi Nomura

Change lv_mirror_count() to cope with stacked mirror with resync layers.

When adding mirrors to already mirrored LV, LVM2 will stack a temporary mirror layer for resync.

So the lv_mirror_count() should take into account these things:
- loop down through the mirror stack
- exclude the resync LV from the count

Thanks,

Signature · 9 lines
Jun'ichi Nomura, NEC Corporation of America

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-lv_mirror_count.patch
Type: text/x-patch
Size: 2114 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/bf5cee0f/attachment.bin>
#6 lore raw

PATCH 6/13 remove_mirror_images() to cope with stacked mirror

In reply to Jun'ichi Nomura

Change remove_mirror_images()
- take LV as an argument, instead of LV segment, because segment-lv relationship could change after the layer removal
- to cope with the stacked mirror LV, check the difference between lv_mirror_count() and seg->area_count.
Iterate in this way: remove legs from the top-level mirror, if the mirror is turned to linear, collapse one layer and restart with remainder.

Thanks,

Signature · 9 lines
Jun'ichi Nomura, NEC Corporation of America

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-remove_mirror_images.patch
Type: text/x-patch
Size: 7968 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/134f412b/attachment.bin>
#7 lore raw

PATCH 7/13 lv_extend() to cope with stacked mirror

In reply to Jun'ichi Nomura

Mirrored LV could be stacked with temporary resync layers. So lv_extend() should walk down the stack.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-extend.patch
Type: text/x-patch
Size: 2886 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/227e5519/attachment.bin>
#8 lore raw

PATCH 8/13 lvconvert to stack a temporary resync mirror on addition

In reply to Jun'ichi Nomura

Allow lvconvert to add mirror by inserting a "_resync<n>" layer and add mirrors to it.

FIXME: Limited to corelog. It'll be fixed with later patches.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-add-mirror.patch
Type: text/x-patch
Size: 1744 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/c0cf5df9/attachment.bin>
#9 lore raw

PATCH 9/13 Add collapsing feature for stacked mirror

In reply to Jun'ichi Nomura

This is the main patch of this patchset.

Add collapsing feature to the stacked mirror. dmeventd should be changed to call it when it detects the completion of resync.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-collapse-layers.patch
Type: text/x-patch
Size: 5654 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/2a0a0ecb/attachment.bin>
#10 lore raw

PATCH 10/13 Add '--collapse' option to lvconvert

In reply to Jun'ichi Nomura

This patch adds '--collapse' option to lvconvert command.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-lvconvert.patch
Type: text/x-patch
Size: 3384 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/1bd24207/attachment.bin>
#11 lore raw

PATCH 11/13 Add 'lv_mirrors' field to reporting functions

In reply to Jun'ichi Nomura

This patch adds 'lv_mirrors' field to reporting commands. It is the number of mirrors for the LV.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-report.patch
Type: text/x-patch
Size: 2769 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/564297d0/attachment.bin>
#12 lore raw

PATCH 12/13 Remove hardcoded "_mlog" name from deptree construction

In reply to Jun'ichi Nomura

This patch removes "_mlog" hardcoding in deptree construction code and use seg->log_lv instead.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-deptree-generalize-mlog.patch
Type: text/x-patch
Size: 974 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/f8277303/attachment.bin>
#13 lore raw

PATCH 13/13 Allow disk logs for temporary resync mirror

In reply to Jun'ichi Nomura

With the previous patch ("12/13"), we can use multiple disk logs in the LV.
So unlock the use of disk log for added mirror.

Thanks,

Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lvm2-stacked-mirror-multi-mlogs.patch
Type: text/x-patch
Size: 1652 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071220/d9d6c7a6/attachment.bin>