LVM2 lib/format_text/flags.c lib/format_text/i ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2008-01-10 18:35:51
Modified files:
lib/format_text: flags.c import_vsn1.c
lib/metadata : metadata-exported.h mirror.c
lib/report : columns.h report.c
man : lvs.8 pvs.8 vgs.8
tools : lvchange.c lvconvert.c tools.h
Log message:
Various lvconvert/polldaemon-related fixes from NEC. See lvm-devel for original patches & explanations.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/flags.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/columns.h.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvs.8.diff?cvsroot=lvm2&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/pvs.8.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgs.8.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.84&r2=1.85
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.59&r2=1.60
lib/format_text/flags.c +1 -0
@@ -60,6 +60,7 @@ {VIRTUAL, NULL}, {SNAPSHOT, NULL}, {ACTIVATE_EXCL, NULL}, + {CONVERTING, NULL}, {0, NULL} };
lib/format_text/import_vsn1.c +19 -0
@@ -86,6 +86,22 @@return 1 ; } +static int _is_converting (struct logical_volume *lv) +{ +struct lv_segment *seg; + +if (lv->status &MIRRORED ) { + seg =first_seg (lv); +/* Can't use is_temporary_mirror() because the metadata for +* seg_lv may not be read in and flags may not be set yet. */ +if (seg_type (seg,0 ) ==AREA_LV && +strstr (seg_lv (seg,0 )->name,MIRROR_SYNC_LAYER )) +return 1 ; + } + +return 0 ; +} +static int _read_id (struct id *id,struct config_node *cn,const char *path) {struct config_value *cv;
@@ -343,6 +359,9 @@if (seg_is_virtual (seg)) lv->status |=VIRTUAL ; +if (_is_converting (lv)) + lv->status |=CONVERTING ; +return 1 ; }
lib/metadata/metadata-exported.h +1 -0
@@ -69,6 +69,7 @@#define MIRROR_NOTSYNCED 0x00080000U/* LV */ //#define ACTIVATE_EXCL 0x00100000U /* LV - internal use only */ //#define PRECOMMITTED 0x00200000U /* VG - internal use only */ +#define CONVERTING 0x00400000U/* LV */ #define LVM_READ 0x00000100U/* LV VG */ #define LVM_WRITE 0x00000200U/* LV VG */
lib/metadata/mirror.c +50 -44
177 lines not on this page · raw message
lib/report/columns.h +1 -0
@@ -33,6 +33,7 @@ FIELD(LVS, lv, NUM, "Snap%", lvid, 6, snpercent, "snap_percent", "For snapshots, the percentage full if LV is active.") FIELD(LVS, lv, NUM, "Copy%", lvid, 6, copypercent, "copy_percent", "For mirrors and pvmove, current percentage in-sync.") FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, "move_pv", "For pvmove, Source PV of temporary LV created by pvmove") +FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, "convert_lv", "For lvconvert, Name of temporary LV created by lvconvert") FIELD(LVS, lv, STR, "LV Tags", tags, 7, tags, "lv_tags", "Tags, if any.") FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, "mirror_log", "For mirrors, the LV holding the synchronisation log.")FIELD (LVS , lv,STR ,"Modules" , lvid,7 , modules,"modules" ,"Kernel device-mapper modules required for this LV." )
lib/report/report.c +29 -1
@@ -272,7 +272,7 @@return dm_report_field_uint64 (rh, field, &_minusone); } -static int _lv_mimage_in_sync (struct logical_volume *lv) +static int _lv_mimage_in_sync (const struct logical_volume *lv) {float percent;struct lv_segment *seg =first_seg (lv);
@@ -306,6 +306,8 @@if (lv->status &PVMOVE ) repstr[0 ] ='p' ; +else if (lv->status &CONVERTING ) + repstr[0 ] ='c' ;else if (lv->status &MIRRORED ) {if (lv->status &MIRROR_NOTSYNCED ) repstr[0 ] ='M' ;
@@ -548,6 +550,32 @@return 1 ; } +static int _convertlv_disp (struct dm_report *rh,struct dm_pool *mem __attribute((unused)), +struct dm_report_field *field, +const void *data,void *private __attribute((unused))) +{ +const struct logical_volume *lv = (const struct logical_volume *) data; +const char *name =NULL ; +struct lv_segment *seg; + +if (lv->status &CONVERTING ) { +if (lv->status &MIRRORED ) { + seg =first_seg (lv); + +/* Temporary mirror is always area_num == 0 */ +if (seg_type (seg,0 ) ==AREA_LV && +is_temporary_mirror_layer (seg_lv (seg,0 ))) + name =seg_lv (seg,0 )->name; + } + } + +if (name) +return dm_report_field_string (rh, field, &name); + +dm_report_field_set_value (field,"" ,NULL ); +return 1 ; +} +static int _size32_disp (struct dm_report *rh __attribute((unused)),struct dm_pool *mem,struct dm_report_field *field,const void *data,void *private)
man/lvs.8 +3 -1
@@ -47,7 +47,8 @@ .RS .IP 1 3 Volume type: (m)irrored, (M)irrored without initial sync, (o)rigin, (p)vmove, (s)napshot, -invalid (S)napshot, (v)irtual, mirror (i)mage, mirror (I)mage out-of-sync +invalid (S)napshot, (v)irtual, mirror (i)mage, mirror (I)mage out-of-sync, +under (c)onversion .IP 2 3 Permissions: (w)riteable, (r)ead-only .IP 3 3
@@ -82,6 +83,7 @@ of 1000 (S.I.) instead of 1024. Can also specify custom (u)nits e.g. \-\-units 3M .SH SEE ALSO +.BR lvm (8), .BR lvdisplay (8), .BR pvs (8), .BR vgs (8)
man/pvs.8 +1 -0
@@ -58,6 +58,7 @@ of 1000 (S.I.) instead of 1024. Can also specify custom (u)nits e.g. \-\-units 3M .SH SEE ALSO +.BR lvm (8), .BR pvdisplay (8), .BR lvs (8), .BR vgs (8)
man/vgs.8 +1 -0
@@ -71,6 +71,7 @@ of 1000 (S.I.) instead of 1024. Can also specify custom (u)nits e.g. \-\-units 3M .SH SEE ALSO +.BR lvm (8), .BR vgdisplay (8), .BR pvs (8), .BR lvs (8)
tools/lvchange.c +14 -0
@@ -106,6 +106,8 @@ {int activate;const char *pvname; +char *lv_full_name; +uint32_t len; activate =arg_uint_value (cmd, available_ARG,0 );
@@ -158,6 +160,18 @@ pvname);pvmove_poll (cmd, pvname,1 ); } + +if (lv->status &CONVERTING ) { + len =strlen (lv->vg->name) +strlen (lv->name) +2 ; +if (!(lv_full_name =alloca (len))) + return_0; +if (!dm_snprintf (lv_full_name, len,"%s/%s" , + lv->vg->name, lv->name)) + return_0; +log_verbose ("Spawning background lvconvert process for %s" , + lv->name); +lvconvert_poll (cmd, lv_full_name,1 ); + } }return 1 ;
tools/lvconvert.c +44 -12
111 lines not on this page · raw message
tools/tools.h +1 -0
@@ -165,5 +165,6 @@const char *command_name (struct cmd_context *cmd);int pvmove_poll (struct cmd_context *cmd,const char *pv,unsigned background); +int lvconvert_poll (struct cmd_context *cmd,const char *lv_name,unsigned background);#endif