LVM2 ./WHATS_NEW man/lvconvert.8 man/lvcreate. ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2007-08-01 21:01:06
Modified files:
. : WHATS_NEW man : lvconvert.8 lvcreate.8 tools : args.h commands.h lvconvert.c lvcreate.c
Log message:
This patch changes the arguments that specify the mirror log type. Previously, we had a '--corelog' argument that would change the default type from 'disk' to 'core'. I think that creates too much confusion - especially when doing conversions on mirrors.
The new argument '--log' takes either "disk" or "core" as a parameter. This could be expanded in the future for additional logging types as well.
Examples:
# Creating a 2-way mirror
$> lvcreate -m1 ... # implicitly use default disk logging $> lvcreate -m1 --log disk ... # explicit disk logging $> lvcreate -m1 --log core ... # specify core logging $> lvcreate -m1 --corelog ... # old way still works
# Conversion examples
$> lvconvert --log core ... # convert to core logging
$> lvconvert --log disk ... # convert to disk logging
$> lvconvert -mX --corelog ... # old way still works
$> lvconvert -mX ... # old way of converting to disk logging still works
Changes are reflected in the man pages.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.675&r2=1.676
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvcreate.8.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.97&r2=1.98
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.138&r2=1.139
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.28 - ================================ + Add --log argument to specify log type for mirrors. Don't try to monitor devices which we failed to create. Don't leak a file descriptor in fcntl_lock_file(), when fcntl fails. Remove create_dir function; use now-equivalent dm_create_dir instead
man/lvconvert.8 +14 -13
@@ -3,7 +3,7 @@ lvconvert \- convert a logical volume from linear to mirror or snapshot .SH SYNOPSIS .B lvconvert -\-m/\-\-mirrors Mirrors [\-\-corelog] [\-R/\-\-regionsize MirrorLogRegionSize] +\-m/\-\-mirrors Mirrors [\-\-log {disk|core}] [\-R/\-\-regionsize MirrorLogRegionSize] [\-A/\-\-alloc AllocationPolicy] [\-h/\-?/\-\-help] [\-v/\-\-verbose]
@@ -37,12 +37,10 @@ volume to a mirror volume with 2-sides; that is, a linear volume plus one copy. .TP -.I \-\-corelog -This optional argument tells lvconvert to switch the -mirror from using a disk-based (persistent) log to -an in-memory log. You may only specify this option -when the \-\-mirror argument is the same degree of -the mirror you are changing. +.I \-\-log disk/core +This optional argument gives the ability to switch the +logging type that is used by a mirror. The logging type +can be either "disk" (persistent) or "core" (non-persistent). .TP .I \-R, \-\-regionsize MirrorLogRegionSize A mirror is divided into regions of this size (in MB), and the mirror log
@@ -64,14 +62,17 @@ "lvconvert -m1 vg00/lvol1" .br converts the linear logical volume "vg00/lvol1" to -a mirror logical volume. This command could also -be used to convert a two-way mirror with an -in-memory log to a two-way mirror with a disk log. +a two-legged mirror logical volume. -"lvconvert -m1 --corelog vg00/lvol1" +"lvconvert --log core vg00/lvol1" .br -converts a two-way mirror with a disk log to a -two-way mirror with an in-memory log. +converts a mirror with a disk log to a +mirror with an in-memory log. + +"lvconvert --log disk vg00/lvol1" +.br +converts a mirror with an in-memory log +to a mirror with a disk log. "lvconvert -m0 vg00/lvol1" .br
man/lvcreate.8 +12 -6
@@ -11,7 +11,7 @@ {\-l/\-\-extents LogicalExtentsNumber[%{VG|FREE}] | \-L/\-\-size LogicalVolumeSize[kKmMgGtT]} [\-M/\-\-persistent y/n] [\-\-minor minor] -[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-corelog] +[\-m/\-\-mirrors Mirrors [\-\-nosync] [\-\-log {disk|log}] [\-R/\-\-regionsize MirrorLogRegionSize]] [\-n/\-\-name LogicalVolumeName] [\-p/\-\-permission r/rw] [\-r/\-\-readahead ReadAheadSectors]
@@ -95,11 +95,13 @@ copied. This is useful for skipping a potentially long and resource intensive initial sync. -Specifying the optional argument "--corelog" will create a mirror with -an in-memory log verses a disk-based (persistent) log. While this -removes the need for an extra log device and *may* be slightly faster, -it requires that the entire mirror be resynchronized upon each -instantiation (e.g. a reboot). +The optional argument "--log" gives the ability to specify the type +of mirror log to be used. The available types are "disk" and "core", +where "disk" is the default. The "disk" log is persistent and requires +a small amount of storage space - usually on a separate device from the +mirror legs. While the "disk" log may cause the mirror to be slightly +slower during writes, it prevents the need to completely resynchronize +the mirror upon each instantiation (e.g. a reboot). .TP .I \-n, \-\-name LogicalVolumeName The name for the new logical volume.
@@ -157,6 +159,10 @@ require 3 devices - two for the mirror devices and one for the disk log. +"lvcreate -m1 --log core -L 500M vg00" tries to create a mirror logical volume +with 2 sides with a useable size of 500 MiB. This operation would +require 2 devices - the log is "in-memory". + "lvcreate --size 100m --snapshot --name snap /dev/vg00/lvol1" .br creates a snapshot logical volume named /dev/vg00/snap which has access to the
tools/args.h +1 -0
@@ -48,6 +48,7 @@ arg(nosync_ARG, '\0', "nosync", NULL) arg(resync_ARG, '\0', "resync", NULL) arg(corelog_ARG, '\0', "corelog", NULL) +arg(log_ARG, '\0', "log", string_arg) arg(monitor_ARG, '\0', "monitor", yes_no_arg) arg(config_ARG, '\0', "config", string_arg)arg (trustcache_ARG,'\0' ,"trustcache" ,NULL )
tools/commands.h +5 -5
@@ -88,7 +88,7 @@xx (lvconvert,"Change logical volume layout" ,"lvconvert " -"[-m|--mirrors Mirrors [--corelog]]\n" +"[-m|--mirrors Mirrors [--log {disk|core}]]\n" "\t[-R|--regionsize MirrorLogRegionSize]\n" "\t[--alloc AllocationPolicy]\n" "\t[-d|--debug]\n"
@@ -107,8 +107,8 @@ "\t[--version]" "\n" "\tOriginalLogicalVolume[Path] SnapshotLogicalVolume[Path]\n", - alloc_ARG, chunksize_ARG, mirrors_ARG, corelog_ARG, regionsize_ARG, - snapshot_ARG, test_ARG, zero_ARG) + alloc_ARG, chunksize_ARG, mirrors_ARG, corelog_ARG, log_ARG, + regionsize_ARG, snapshot_ARG, test_ARG, zero_ARG) xx(lvcreate, "Create a logical volume",
@@ -123,7 +123,7 @@"\t{-l|--extents LogicalExtentsNumber |\n" "\t -L|--size LogicalVolumeSize[kKmMgGtTpPeE]}\n" "\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n" -"\t[-m|--mirrors Mirrors [--nosync] [--corelog]]\n" +"\t[-m|--mirrors Mirrors [--nosync] [--log {disk|core}]]\n" "\t[-n|--name LogicalVolumeName]\n" "\t[-p|--permission {r|rw}]\n" "\t[-r|--readahead ReadAheadSectors]\n"
@@ -156,7 +156,7 @@"\tOriginalLogicalVolume[Path] [PhysicalVolumePath...]\n\n" , addtag_ARG, alloc_ARG, autobackup_ARG, chunksize_ARG, contiguous_ARG, - corelog_ARG, extents_ARG, major_ARG, minor_ARG, mirrors_ARG, name_ARG, + corelog_ARG, log_ARG, extents_ARG, major_ARG, minor_ARG, mirrors_ARG, name_ARG, nosync_ARG, permission_ARG, persistent_ARG, readahead_ARG, regionsize_ARG, size_ARG, snapshot_ARG, stripes_ARG, stripesize_ARG, test_ARG, type_ARG, zero_ARG)
tools/lvconvert.c +53 -8
114 lines not on this page · raw message
tools/lvcreate.c +20 -1
@@ -241,6 +241,7 @@int argc = *pargc;int region_size;int pagesize =lvm_getpagesize (); +const char *log_arg;if (argc && (unsigned ) argc < lp->mirrors) { log_error("Too few physical volumes on "
@@ -284,7 +285,25 @@return 0 ; } - lp->corelog =arg_count (cmd, corelog_ARG) ?1 :0 ; +if (arg_count (cmd, corelog_ARG)) { +log_verbose ("Setting logging type to \"core\"" ); + lp->corelog =1 ; + } + +if (arg_count (cmd, log_ARG)) { + log_arg =arg_str_value (cmd, log_ARG,"disk" ); +if (!strcmp ("disk" , log_arg)) { +log_verbose ("Setting logging type to \"disk\"" ); + lp->corelog =0 ; + }else if (!strcmp ("core" , log_arg)) { +log_verbose ("Setting logging type to \"core\"" ); + lp->corelog =1 ; + }else { +log_error ("Unknown logging type, \"%s\"" , log_arg); +return 0 ; + } + } + lp->nosync =arg_count (cmd, nosync_ARG) ?1 :0 ;return 1 ;
Quoted 5 lines · jbrassow at sourceware.org
# Creating a 2-way mirror $> lvcreate -m1 ... # implicitly use default disk logging $> lvcreate -m1 --log disk ... # explicit disk logging $> lvcreate -m1 --log core ... # specify core logging $> lvcreate -m1 --corelog ... # old way still works
I don't see code to cope with '--corelog --log disk'. Simplest just to disallow both options at once?
Quoted 2 lines
+++ LVM2/WHATS_NEW 2007/08/01 21:01:06 1.676
+ Add --log argument to specify log type for mirrors.
Slightly more detail called for: lvconvert & lvcreate.
Quoted 2 lines
+++ LVM2/man/lvconvert.8 2007/08/01 21:01:06 1.6
-\-m/\-\-mirrors Mirrors [\-\-corelog] [\-R/\-\-regionsize MirrorLogRegionSize]
--corelog still needs to be there!
man/lvconvert.8 line 45
Quoted 7 lines
.TP
-.I \-\-corelogman/lvconvert.8 +0
-5-This optional argument tells lvconvert to switch the -mirror from using a disk-based (persistent) log to -an in-memory log. You may only specify this option -when the \-\-mirror argument is the same degree of -the mirror you are changing.
Ditto. Move below, then say it's same as --log core.
Quoted 2 lines
+.I \-\-log disk/core
+This optional argument gives the ability to switch the
"...argument switches..."
Quoted 1 line
+logging type that is used by a mirror. The logging type
"that is used by" - rephrase - "of"?
"switches from...to..." else "changes to"
Review
Quoted 4 lines
(quoted diff) +2
-0+can be either "disk" (persistent) or "core" (non-persistent). +a two-legged mirror logical volume.
Do we use 'legs' anywhere? Is our teminology inconsistent?
Quoted 1 line
+++ LVM2/man/lvcreate.8 2007/08/01 21:01:06 1.15
Similar comments.
man/lvcreate.8 line 104
Quoted 12 lines
man/lvcreate.8 +7
-5-Specifying the optional argument "--corelog" will create a mirror with -an in-memory log verses a disk-based (persistent) log. While this -removes the need for an extra log device and *may* be slightly faster, -it requires that the entire mirror be resynchronized upon each -instantiation (e.g. a reboot). +The optional argument "--log" gives the ability to specify the type +of mirror log to be used. The available types are "disk" and "core", +where "disk" is the default. The "disk" log is persistent and requires +a small amount of storage space - usually on a separate device from the +mirror legs. While the "disk" log may cause the mirror to be slightly +slower during writes, it prevents the need to completely resynchronize +the mirror upon each instantiation (e.g. a reboot).
Please try to improve this so the emphasis remains on encouraging the default behaviour (disk). Also, please remove the quotes around "disk". We don't use them elsewhere. And use .I for arguments like --log.
tools/commands.h line 91
Quoted 3 lines
+++
LVM2/tools/commands.h2007/08/01 21:01:06 1.98tools/commands.h +1
-1-"[-m|--mirrors Mirrors [--corelog]]\n" +"[-m|--mirrors Mirrors [--log {disk|core}]]\n"
And again: --corelog must remain for compatibility reasons! We can't just pretend it never existed. What if someone finds it in an existing script and looks at the help/man page and it's not there?
tools/lvconvert.c line 104
Quoted 3 lines
+++
LVM2/tools/lvconvert.c2007/08/01 21:01:06 1.31tools/lvconvert.c +1
-0+int count;
Please use a more-specific variable name.
tools/lvconvert.c line 113
Quoted 4 lines
tools/lvconvert.c +4
-0+if (arg_count (cmd, log_ARG) >1 ) { +log_error ("Too many --log arguments supplied." ); +return 0 ; + }
If we're going to test for multiple arguments, please do this generically, not in every tool independently! This section needs to come out.
tools/lvconvert.c line 128
Quoted 6 lines
tools/lvconvert.c +6
-0+if (arg_count (cmd, log_ARG) ||arg_count (cmd, mirrors_ARG)) + count =1 ; + count +=arg_count (cmd, snapshot_ARG); +if (count !=1 ) { +log_error ("--snapshots argument cannot be mixed " +"with --mirrors or --log" );
Drop 'count' and do this all in one go?
if (snapshots and (mirrors or log))
tools/lvconvert.c line 254
Quoted 2 lines
tools/lvconvert.c +1
-0@@ -237,6 +254,8 @@ +int corelog =0 ;
Firstly, you're using this unsigned; but secondly it's really an enum.
Quoted 12 lines
tools/lvconvert.c +11
-0@@ -267,6 +286,31 @@ +/* +* Adjust log type +*/ +if (arg_count (cmd, corelog_ARG)) { +log_verbose ("Setting logging type to \"core\"" ); + corelog =1 ; + } + +if (arg_count (cmd, log_ARG)) { + log_arg =arg_str_value (cmd, log_ARG,"disk" ); +if (!strcmp ("disk" , log_arg)) {
tools/lvconvert.c line 306
Quoted 10 lines
tools/lvconvert.c +10
-0+log_verbose ("Setting logging type to \"disk\"" ); + corelog =0 ; + }else if (!strcmp ("core" , log_arg)) { +log_verbose ("Setting logging type to \"core\"" ); + corelog =1 ; + }else { +log_error ("Unknown logging type, \"%s\"" , log_arg); +return 0 ; + } + }
Just one "Setting logging type to %s." please. Prevent incompatible --log and --corelog together. And use the enum, perhaps, to record the log type.
tools/lvcreate.c
Quoted 2 lines
tools/lvcreate.c +0
-0
Similar comments.
Alasdair
Signature · 1 line
agk at redhat.com
Review
Quoted 1 line · jbrassow at sourceware.org
(quoted diff) +1
-0+ log_arg = arg_str_value(cmd, log_ARG, "disk");
Should probably put that hard-coding into defaults.h.
Alasdair
Signature · 1 line
agk at redhat.com