LVM2 ./WHATS_NEW lib/format1/import-export.c l ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-01-16 19:01:00
Modified files:
. : WHATS_NEW
lib/format1 : import-export.c
lib/format_pool: import_export.c lib/format_text: import_vsn1.c
lib/metadata : lv_alloc.h lv_manip.c merge.c
metadata-exported.h metadata.h mirror.c
lib/report : report.c
tools : vgreduce.c
Log message:
Maintain lists of stacked LV segments using each LV.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.763&r2=1.764
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.91&r2=1.92
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/import_export.c.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_alloc.h.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.140&r2=1.141
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/merge.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.34&r2=1.35
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.176&r2=1.177
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
WHATS_NEW +2 -0
@@ -1,5 +1,7 @@ Version 2.02.30 - =================================== + Maintain lists of stacked LV segments using each LV. + Change vgsplit -l (for unimplemented --list) into --maxlogicalvolumes. Fix process_all_pvs to detect non-orphans with no MDAs correctly. Don't use block_on_error with mirror targets version 1.12 and above. Update vgsplit to include vgcreate-style options when new VG is destination.
lib/format1/import-export.c +1 -0
@@ -361,6 +361,7 @@list_init (&lv->snapshot_segs);list_init (&lv->segments);list_init (&lv->tags); +list_init (&lv->segs_using_this_lv);return 1 ; }
lib/format_pool/import_export.c +1 -0
@@ -83,6 +83,7 @@list_init (&lv->snapshot_segs);list_init (&lv->segments);list_init (&lv->tags); +list_init (&lv->segs_using_this_lv); list_iterate_items(pl, pls) { lv->size += pl->pd.pl_blocks;
lib/format_text/import_vsn1.c +5 -2
@@ -408,8 +408,10 @@return 0 ; } }else if ((lv1 =find_lv (seg->lv->vg, cv->v.str))) { -set_lv_segment_area_lv (seg, s, lv1, (uint32_t ) cv->next->v.i, - flags); +if (!set_lv_segment_area_lv (seg, s, lv1, + (uint32_t ) cv->next->v.i, + flags)) + return_0; }else { log_error("Couldn't find volume '%s' " "for segment '%s'.",
@@ -562,6 +564,7 @@list_init (&lv->snapshot_segs);list_init (&lv->segments);list_init (&lv->tags); +list_init (&lv->segs_using_this_lv);/* Optional tags */ if ((cn = find_config_node(lvn, "tags")) &&
lib/metadata/lv_alloc.h +3 -3
@@ -33,9 +33,9 @@int set_lv_segment_area_pv (struct lv_segment *seg,uint32_t area_num,struct physical_volume *pv,uint32_t pe); -void set_lv_segment_area_lv (struct lv_segment *seg,uint32_t area_num, -struct logical_volume *lv,uint32_t le, -uint32_t flags); +int set_lv_segment_area_lv (struct lv_segment *seg,uint32_t area_num, +struct logical_volume *lv,uint32_t le, +uint32_t flags);int move_lv_segment_area (struct lv_segment *seg_to,uint32_t area_to,struct lv_segment *seg_from,uint32_t area_from); void release_lv_segment_area(struct lv_segment *seg, uint32_t s,
lib/metadata/lv_manip.c +91 -43
223 lines not on this page · raw message
lib/metadata/merge.c +54 -8
106 lines not on this page · raw message
lib/metadata/metadata-exported.h +2 -3
@@ -242,7 +242,6 @@uint32_t region_size;/* For mirrors - in sectors */ uint32_t extents_copied;struct logical_volume *log_lv; -struct lv_segment *mirror_seg;struct list tags;
@@ -274,6 +273,7 @@struct list segments;struct list tags; +struct list segs_using_this_lv; };struct pe_range {
@@ -412,8 +412,6 @@ struct list *lvs_changed);int split_parent_segments_for_layer (struct cmd_context *cmd,struct logical_volume *layer_lv); -struct logical_volume *find_parent_for_layer (struct logical_volume *lv, -struct logical_volume *layer_lv);int remove_layer_from_lv (struct logical_volume *lv,struct logical_volume *layer_lv); struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
@@ -464,6 +462,7 @@/* * Mirroring functions */ +struct lv_segment *find_mirror_seg (struct lv_segment *seg); int lv_add_mirrors(struct cmd_context *cmd, struct logical_volume *lv, uint32_t mirrors, uint32_t stripes, uint32_t region_size, uint32_t log_count,
lib/metadata/metadata.h +14 -1
@@ -158,6 +158,12 @@struct pv_segment *peg; }; +struct seg_list { +struct list list; +unsigned count; +struct lv_segment *seg; +}; +/* * Ownership of objects passes to caller. */
@@ -293,13 +299,20 @@int lv_split_segment (struct logical_volume *lv,uint32_t le);/* +* Add/remove upward link from underlying LV to the segment using it +* FIXME: ridiculously long name +*/ +int add_seg_to_segs_using_this_lv (struct logical_volume *lv,struct lv_segment *seg); +int remove_seg_from_segs_using_this_lv (struct logical_volume *lv,struct lv_segment *seg); +struct lv_segment *get_only_segment_using_this_lv (struct logical_volume *lv); + +/* * Mirroring functions */ /* * Given mirror image or mirror log segment, find corresponding mirror segment */ -struct lv_segment *find_mirror_seg (struct lv_segment *seg);int fixup_imported_mirrors (struct volume_group *vg);/*
lib/metadata/mirror.c +50 -20
132 lines not on this page · raw message
lib/report/report.c +3 -4
@@ -275,13 +275,12 @@static int _lv_mimage_in_sync (const struct logical_volume *lv) {float percent; -struct lv_segment *seg =first_seg (lv); +struct lv_segment *mirror_seg =find_mirror_seg (first_seg (lv)); -if (!(lv->status &MIRROR_IMAGE ) || !seg->mirror_seg) +if (!(lv->status &MIRROR_IMAGE ) || !mirror_seg) return_0; -if (!lv_mirror_percent (lv->vg->cmd, seg->mirror_seg->lv,0 , - &percent,NULL )) +if (!lv_mirror_percent (lv->vg->cmd, mirror_seg->lv,0 , &percent,NULL )) return_0;if (percent >=100.0 )
tools/vgreduce.c +2 -7
@@ -50,7 +50,7 @@static int _remove_lv (struct cmd_context *cmd,struct logical_volume *lv,int *list_unsafe,struct list *lvs_changed) { -struct lv_segment *snap_seg, *mirror_seg; +struct lv_segment *snap_seg;struct list *snh, *snht;struct logical_volume *cow;struct lv_list *lvl;
@@ -117,9 +117,8 @@* Clean-up is currently done by caller (_make_vg_consistent()). */ if ((lv_info (cmd, lv, &info,0 ,0 ) && info.exists) - ||first_seg (lv)->mirror_seg) { + ||find_mirror_seg (first_seg (lv))) { extents = lv->le_count; - mirror_seg =first_seg (lv)->mirror_seg;if (!lv_empty (lv)) { stack;return 0 ;
@@ -130,10 +129,6 @@ stack;return 0 ; } -if (mirror_seg) { -first_seg (lv)->status |=MIRROR_IMAGE ; -first_seg (lv)->mirror_seg = mirror_seg; - }if (!(lvl =dm_pool_alloc (cmd->mem,sizeof (*lvl)))) {log_error ("lv_list alloc failed" );