LVM2 ./WHATS_NEW lib/format1/import-export.c l ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2009-05-13 21:21:59
Modified files:
. : WHATS_NEW
lib/format1 : import-export.c
lib/format_text: import_vsn1.c
lib/metadata : metadata-exported.h snapshot_manip.c
lib/snapshot : snapshot.c
tools : lvconvert.c lvcreate.c
Log message:
Fix snapshot segment import to not use duplicate segments & replace.
The snapshot segment (snapshotX) is created twice during the text metadata segment processing.
This can cause temporary violation of max_lv count.
Simplify the code, snapshot segment is properly initialized in init_snapshot_seg function now and do not need to be replaced by vg_add_snapshot call.
The vg_add_snapshot() is now usefull only for adding new snapshot and it shares the same initialization function.
The snapshot name is always generated, name paramater can be removed from function call.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1103&r2=1.1104
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/snapshot_manip.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/snapshot/snapshot.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.185&r2=1.186
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.46 - ================================ + Fix snapshot segment import to not use duplicate segments & replace. Do not query nonexistent devices for readahead. Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. Remove snapshot_count from VG and use function instead.
lib/format1/import-export.c +1 -1
@@ -616,7 +616,7 @@continue ;/* insert the snapshot */ -if (!vg_add_snapshot (NULL , org, cow,NULL , +if (!vg_add_snapshot (org, cow,NULL , org->le_count, lvd->lv_chunk_size)) {log_err ("Couldn't add snapshot." );
lib/format_text/import_vsn1.c +0 -10
@@ -603,16 +603,6 @@ lv->size = (uint64_t ) lv->le_count * (uint64_t ) vg->extent_size; -/* -* FIXME We now have 2 LVs for each snapshot. The real one was -* created by vg_add_snapshot from the segment text_import. -*/ -if (lv->status &SNAPSHOT ) { - vg->lv_count--; -dm_list_del (&lvl->list); -return 1 ; - } - lv->minor =-1 ;if ((lv->status &FIXED_MINOR ) && !_read_int32 (lvn,"minor" , &lv->minor)) {
lib/metadata/metadata-exported.h +4 -2
@@ -545,8 +545,10 @@/* Given a cow LV, return its origin */ struct logical_volume *origin_from_cow (const struct logical_volume *lv); -int vg_add_snapshot (const char *name, -struct logical_volume *origin,struct logical_volume *cow, +void init_snapshot_seg (struct lv_segment *seg,struct logical_volume *origin, +struct logical_volume *cow,uint32_t chunk_size); + +int vg_add_snapshot (struct logical_volume *origin,struct logical_volume *cow,union lvid *lvid,uint32_t extent_count,uint32_t chunk_size);
lib/metadata/snapshot_manip.c +29 -26
75 lines not on this page · raw message
lib/snapshot/snapshot.c +1 -5
@@ -39,8 +39,6 @@struct logical_volume *org, *cow;int old_suppress; - seg->lv->status |=SNAPSHOT ; -if (!get_config_uint32 (sn,"chunk_size" , &chunk_size)) {log_error ("Couldn't read chunk size for snapshot." );return 0 ;
@@ -74,9 +72,7 @@return 0 ; } -if (!vg_add_snapshot (seg->lv->name, org, cow, - &seg->lv->lvid, seg->len, chunk_size)) - return_0; +init_snapshot_seg (seg, org, cow, chunk_size);return 1 ; }
tools/lvconvert.c +1 -2
@@ -760,8 +760,7 @@return 0 ; } -if (!vg_add_snapshot (NULL , org, lv,NULL , org->le_count, - lp->chunk_size)) { +if (!vg_add_snapshot (org, lv,NULL , org->le_count, lp->chunk_size)) {log_error ("Couldn't create snapshot." );return 0 ; }
tools/lvcreate.c +1 -1
@@ -918,7 +918,7 @@/* cow LV remains active and becomes snapshot LV */ -if (!vg_add_snapshot (NULL , org, lv,NULL , +if (!vg_add_snapshot (org, lv,NULL , org->le_count, lp->chunk_size)) {log_error ("Couldn't create snapshot." ); goto deactivate_and_revert_new_lv;