Add/collapse temporary mirror
cover Add/collapse temporary mirror
This set of patches allows mirror addition to mirrored LV.
[ 1/13] Enable mirror-addition to lvconvert
[ 2/13] Move idiomatic vg write/lv suspend/vg commit/lv resume
to a function
[ 3/13] Move idiomatic add-lv-to-list operation to a function [ 4/13] Add 'const' for some mirror related functions
[ 5/13] Add collapsing feature of stacked mirror
[ 6/13] Count the correct number of mirror images
[ 7/13] Fix lvconvert to use collapsing and mirror counting [ 8/13] Allow removal of mirror images from not-collapsed mirror LV [ 9/13] Add 'lv_mirrors' field to report commands [10/13] Generalize "mlog" handling of dtree
[11/13] Allow multiple mirror logs in the mirror LV tree [12/13] Allow renaming of mirrored LV with temporary layer [13/13] Allow resizing of mirrored LV with temporary layer
Comments are welcome.
Especially, patches 1, 5, 8 and 10 are important and reviews are appreciated.
Patches 2, 3 and 4 are cosmetic.
Patches 6, 9, 11, 12 and 13 are trivial.
Also, I'm using "lv_mimage_<n>" name for temporary layers because I vaguely remember that naming suffixes like "_mimage_<n>" are important for clusters.
I would like to use other names for temporary layer, for example "lv_mtmp_<n>". Is it ok?
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_mlog
'lvconvert -m+1' will result in this:
testvg-lvol0
|-testvg-lvol0_mimage_3 |-testvg-lvol0_mimage_2 | |-testvg-lvol0_mimage_1 | |-testvg-lvol0_mimage_0 | `-testvg-lvol0_mlog
`-testvg-lvol0_mlog_0
"mimage_2" is a temporary layer to resync "mimage_3".
'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_3 |-testvg-lvol0_mimage_1 |-testvg-lvol0_mimage_0
`-testvg-lvol0_mlog
Thanks,
Signature · 1 line
Jun'ichi Nomura, NEC Corporation of America
cover Add/collapse temporary mirror
Quoted 1 line · Jun'ichi Nomura
because I vaguely remember that naming suffixes like "_mimage_<n>"
dm_snprintf(img_name, len, "%s_mimage_%%d", lv->name)
Gah - how did that underscore sneak in front of the name:-( Oh well, we're stuck with it for now.
Reserved names are controlled by:
apply_lvname_restrictions()
and should be consistent: all 'mimage' LVs should be structured the same way. If not, it may require a different name.
Alasdair
Signature · 1 line
agk at redhat.com
PATCH 1/13 Enable mirror-addition to lvconvert
In reply to Jun'ichi NomuraThis patch allows lvconvert to add mirror to mirrored LV.
If mirrors are added to mirrored LV, a temporary layer will be inserted for resync new mirrors.
The temporary LV is under the same naming rule with mirror images.
Thanks,
Signature · 9 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: 4023 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/4a7f1e47/attachment.bin>
PATCH 2/13 Add _apply_lv_change() to lib/metadata/mirror.c
In reply to Jun'ichi NomuraThis is a cosmetic change of moving idiomatic operations of vg write/lv suspend/vg commit/lv resume to a new function. No functional change.
Thanks,
Signature · 9 lines
Jun'ichi Nomura, NEC Corporation of America -------------- next part -------------- A non-text attachment was scrubbed... Name: lvm2-mirror-apply_lv_change.patch Type: text/x-patch Size: 2429 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/0c6c55ad/attachment.bin>
PATCH 3/13 Add _lv_add_list() to lib/metadata/mirror.c
In reply to Jun'ichi NomuraThis is a cosmetic change of adding _lv_add_list() and removing duplications.
No functional change.
Thanks,
Signature · 9 lines
Jun'ichi Nomura, NEC Corporation of America -------------- next part -------------- A non-text attachment was scrubbed... Name: lvm2-mirror-lv_add_list.patch Type: text/x-patch Size: 1965 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/474e85f8/attachment.bin>
PATCH 4/13 Add 'const' for some mirror related functions
In reply to Jun'ichi NomuraThis patch adds 'const' to some functions used in mirroring code. No functional change.
Thanks,
Signature · 9 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: 2307 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/53c74695/attachment.bin>
PATCH 5/13 Add collapsing feature of stacked mirror
In reply to Jun'ichi NomuraThis patch adds collapse_mirrored_lv() function.
When the function finds a temporary mirror layer in which the resync completed, it removes the layer and moves in-sync mirror images to the original mirror.
Thanks,
Signature · 9 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: 5894 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/87d4394f/attachment.bin>
PATCH 6/13 Count the correct number of mirror images
In reply to Jun'ichi NomuraIf temporary mirror layers are inserted, you can't get the number of mirror images by seg->area_count.
The patch adds a function to recursively sum up the number of mirror images.
Used later by lvconvert and reporting functions.
Thanks,
Signature · 9 lines
Jun'ichi Nomura, NEC Corporation of America -------------- next part -------------- A non-text attachment was scrubbed... Name: lvm2-stacked-mirror-count-legs.patch Type: text/x-patch Size: 1561 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/539d1cd3/attachment.bin>
PATCH 7/13 Fix lvconvert to use collapsing and mirror counting
In reply to Jun'ichi NomuraThis patch changes 2 things in lvconvert:
1) Add '--collapse' option as an interface for users to remove unnecessary mirror layer and collapse the stack.
2) Use the new lv_mirror_count() to get correct existing_mirrors .
Thanks,
Signature · 9 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/20071121/913d4b73/attachment.bin>
PATCH 8/13 Allow removal of mirror images from not-collapsed mirror LV
In reply to Jun'ichi Nomuraremove_mirror_images() is existing function to remove mirror images from mirrored LV.
This patch changes the function to walk through the mirror layers to correctly remove mirror images.
Thanks,
Signature · 9 lines
Jun'ichi Nomura, NEC Corporation of America -------------- next part -------------- A non-text attachment was scrubbed... Name: lvm2-stacked-mirror-remove-legs.patch Type: text/x-patch Size: 3730 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/b4ee06af/attachment.bin>
PATCH 9/13 Add 'lv_mirrors' field to report commands
In reply to Jun'ichi NomuraThis patch adds 'lv_mirrors' field to report commands
to get the correct number of mirror images using lv_mirror_count().
Thanks,
Signature · 9 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/20071121/0637ac01/attachment.bin>
PATCH 10/13 Generalize "mlog" handling of dtree
In reply to Jun'ichi NomuraCurrently, "_mlog" is handled specially in dtree. It puts a restriction to log LV naming and actually, current code can't allow multiple mirror logs in a LV.
This is a problem if we allow to add temporary mirror logs for resynching newly added mirrors.
The patch changes the addition of mirror log to dtree:
BEFORE: Adds a device with lv->name + "_mlog"
AFTER: Adds seg->log_lv
If there is a case where log LV is not set in seg->log_lv but should be treated as a part of dtree, this change breaks the case. I would like to know if there's such a case.
Thanks,
Signature · 9 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/20071121/e961fddc/attachment.bin>
PATCH 11/13 Allow multiple mirror logs in the mirror LV tree
In reply to Jun'ichi NomuraWith the "10/13" patch, mirror LV can have multiple logs in its layers.
This patch enables the namings of "lv_mlog_<n>" and removes a code to force corelog from lvconvert.
Thanks,
Signature · 9 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: 1008 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/f6e3d066/attachment.bin>
PATCH 12/13 Allow renaming of mirrored LV with temporary layer
In reply to Jun'ichi Nomura_for_each_sub_lv() is a function used to execute same function for each LVs used in a given LV's segments.
It's used for lv_rename() to implement mirrored LV renaming.
When we have temporary layers in mirrored LV, mirrored LV is no longer flat. So _for_each_sub_lv() should work recursively.
Thanks,
Signature · 9 lines
Jun'ichi Nomura, NEC Corporation of America -------------- next part -------------- A non-text attachment was scrubbed... Name: lvm2-stacked-mirror-rename.patch Type: text/x-patch Size: 827 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/2ca25828/attachment.bin>
PATCH 13/13 Allow resizing of mirrored LV with temporary layer
In reply to Jun'ichi NomuraThis patch changes 2 things related to resizing mirror.
1) Use lv_mirror_count() to calculate the number of existing mirrors
2) lv_extend() will walk down recursively mirrored LV
to add allocated extents for each mirror image.
Thanks,
Signature · 9 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: 2828 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20071121/2f681e1f/attachment.bin>