Date: Fri, 3 Aug 2007 22:29:58 GMT From: Ulf Lilleengen <lulf@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 124617 for review Message-ID: <200708032229.l73MTwpk083343@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124617 Change 124617 by lulf@lulf_carrot on 2007/08/03 22:29:29 IFC Affected files ... .. //depot/projects/soc2007/lulf/gvinum_main/Makefile.inc1#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sbin/Makefile#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sbin/gvinum/gvinum.8#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sbin/gvinum/gvinum.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/Makefile#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/Makefile.arm#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/NOTES#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.amd64#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.arm#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.i386#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.ia64#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.pc98#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.powerpc#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.sparc64#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/files.sun4v#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/kern.pre.mk#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/kmod.mk#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/options#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/options.amd64#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/options.i386#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/conf/options.pc98#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/part/g_part_mbr.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum.h#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_create.c#1 branch .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_drive.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_events.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_init.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_list.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_move.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_plex.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_raid5.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_raid5.h#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_rename.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_rm.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_share.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_state.c#6 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_subr.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_var.h#6 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/geom/vinum/geom_vinum_volume.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/acpica/acpi_machdep.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/conf/GENERIC#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/conf/NOTES#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/cpufreq/smist.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/genassym.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/pmap.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/swtch.s#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/sys_machdep.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/trap.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/i386/vm_machdep.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/ibcs2/ibcs2_xenix.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/i4b_cause.h#2 delete .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/i4b_debug.h#2 delete .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/i4b_ioctl.h#2 delete .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/i4b_rbch_ioctl.h#2 delete .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/i4b_tel_ioctl.h#2 delete .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/i4b_trace.h#2 delete .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/include/pc/vesa.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/isa/clock.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/linux/linux_machdep.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/i386/xbox/xboxfb.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/Make.tags.inc#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/Makefile#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/init_sysent.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_conf.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_descrip.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_event.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_exec.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_fork.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_kse.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_lockf.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_malloc.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_mutex.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_ntptime.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_priv.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_resource.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_rwlock.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_sig.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_switch.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_sx.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_thread.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/kern_timeout.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/makesyscalls.sh#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/sched_4bsd.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/sched_ule.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/subr_bus.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/subr_clock.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/subr_smp.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/subr_unit.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/subr_witness.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/sys_generic.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/syscalls.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/syscalls.master#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/systrace_args.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/sysv_sem.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/tty.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/tty_pts.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/tty_pty.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/tty_tty.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_domain.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_syscalls.c#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/uipc_usrreq.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/vfs_cache.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/vfs_mount.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/vfs_syscalls.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/kern/vfs_vnops.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/modules/Makefile#5 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/modules/geom/geom_vinum/Makefile#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/_rwlock.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/conf.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/kernel.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/lock_profile.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/mbuf.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/mutex.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/param.h#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/priv.h#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/proc.h#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/rwlock.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/sx.h#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/syscall.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/syscall.mk#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/sysent.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/sysproto.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/systm.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/tree.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/sys/vmmeter.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/swap_pager.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_contig.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_fault.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_meter.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_mmap.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_object.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_page.c#4 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_page.h#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_pageout.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_pageq.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_phys.c#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_phys.h#2 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vm_zeroidle.c#3 integrate .. //depot/projects/soc2007/lulf/gvinum_main/sys/vm/vnode_pager.c#3 integrate Differences ... ==== //depot/projects/soc2007/lulf/gvinum_main/Makefile.inc1#4 (text+ko) ==== @@ -1,5 +1,5 @@ # -# $FreeBSD: src/Makefile.inc1,v 1.582 2007/05/26 20:17:19 ru Exp $ +# $FreeBSD: src/Makefile.inc1,v 1.584 2007/07/10 10:19:45 delphij Exp $ # # Make command line options: # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir @@ -967,6 +967,7 @@ .for _tool in \ gnu/usr.bin/binutils \ gnu/usr.bin/cc \ + usr.bin/sed \ usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ ${_btxld} \ ${_crunchide} \ ==== //depot/projects/soc2007/lulf/gvinum_main/sbin/Makefile#3 (text+ko) ==== @@ -1,5 +1,5 @@ # @(#)Makefile 8.5 (Berkeley) 3/31/94 -# $FreeBSD: src/sbin/Makefile,v 1.166 2007/06/12 21:31:39 phk Exp $ +# $FreeBSD: src/sbin/Makefile,v 1.168 2007/07/24 15:35:00 scottl Exp $ .include <bsd.own.mk> @@ -41,6 +41,7 @@ init \ ${_ipf} \ ipfw \ + iscontrol \ kldconfig \ kldload \ kldstat \ @@ -59,7 +60,6 @@ mount_ntfs \ mount_nullfs \ mount_udf \ - mount_umapfs \ mount_unionfs \ natd \ newfs \ ==== //depot/projects/soc2007/lulf/gvinum_main/sbin/gvinum/gvinum.8#2 (text+ko) ==== @@ -40,6 +40,12 @@ .Op Fl options .Sh COMMANDS .Bl -tag -width indent +.It Ic attach Ar plex volume Op Cm rename +.It Ic attach Ar subdisk plex Oo Ar offset Oc Op Cm rename +Attach a plex to a volume, or a subdisk to a plex. If offset is specified, the +subdisk will be attached to the given offset within the plex. If rename is +specified, the subdisk or plex will change name according to the object it +attaches to. .It Ic checkparity Oo Fl f Oc Ar plex Check the parity blocks of a RAID-5 plex. The parity check will start at the @@ -49,6 +55,9 @@ the first location at which plex's parity is incorrect. All subdisks in the plex must be up for a parity check. +.It Ic concat Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives +Create a concatenated volume from the specified drives. If no name is specified, +a unique name will be set by gvinum. .It Ic create Op Ar description-file Create a volume as described in .Ar description-file . @@ -57,6 +66,9 @@ provided, opens an editor and provides the current .Nm configuration for editing. +.It Ic detach Oo Fl f Oc Op Ar plex | subdisk +Detach a plex or subdisk from the volume or plex to which it is +attached. .It Ic help Provides a synopsis of .Nm @@ -76,6 +88,13 @@ and .Fl V flags provide progressively more detailed output. +.It Ic mirror Oo Fl fsv Oc Oo Fl n Ar name Oc Ar drives +Create a mirrored volume from the specified drives. It requires at least a +multiple of 2 drives. If no name is specified, +a unique name will be set by gvinum. If the +.Fl s +flag is specified, a striped mirror will be created, and thus requires a +multiple of 4 drives. .It Ic move | mv Fl f Ar drive subdisk Op Ar ... Move the subdisk(s) to the specified drive. The @@ -85,8 +104,13 @@ This can currently only be done when the subdisk is not being accessed. .Pp -If the subdisk(s) form part of a RAID-5 plex, the disk(s) will need to be set -to the +If a single subdisk is moved, and it forms a part of a RAID-5 plex, the moved +subdisks will need to be set to the +.Dq stale +state, and the plex will require a +.Ic start +command; If multiple subdisk(s) is moved, and form part of a RAID-5 plex, the +moved disk(s) will need to be set to the .Dq up state and the plex will require a .Ic rebuildparity @@ -105,6 +129,10 @@ when running in interactive mode. Normally this would be done by entering the EOF character. +.It Ic raid5 Oo Fl fv Oc Oo Fl s Ar stripesize Oc Oo Fl n Ar name Oc Ar drives +Create a RAID-5 volume from the specified drives. If no name is specified, +a unique name will be set by Ic gvinum. This organization requires at least +three drives. .It Ic rename Oo Fl r Oc Ar drive | subdisk | plex | volume newname Change the name of the specified object. The @@ -142,10 +170,19 @@ .It Ic start Read configuration from all vinum drives. .It Ic start Oo Fl S Ar size Oc Ar volume | plex | subdisk -Allow the system to access the objects. +Allow the system to access the objects. If necessary, plexes will be synced and +rebuilt. The .Fl S flag is currently ignored. +.It Ic stop Oo Fl f Oc Op Ar volume | plex | subdisk +Terminate access to the objects, or stop +.Nm +if no parameters are specified. +.It Ic stripe Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives +Create a striped volume from the specified drives. If no name is specified, +a unique name will be set by Ic gvinum. This organization requires at least two +drives. .El .Sh DESCRIPTION The @@ -217,15 +254,68 @@ directory with device nodes for .Nm objects -.It Pa /dev/gvinum/plex -directory containing device nodes for -.Nm -plexes -.It Pa /dev/gvinum/sd -directory containing device nodes for -.Nm -subdisks .El +.Sh EXAMPLES +To create a mirror on disks /dev/ad1 and /dev/ad2, create a filesystem, mount, +unmount and then stop Ic gvinum: +.Pp +.Dl "gvinum mirror /dev/ad1 /dev/ad2" +.Dl "newfs /dev/gvinum/gvinumvolume0" +.Dl "mount /dev/gvinum/gvinumvolume0 /mnt" +.Dl "..." +.Dl "unmount /mnt" +.Dl "gvinum stop" +.Pp +To create a striped mirror on disks /dev/ad1 /dev/ad2 /dev/ad3 and /dev/ad4 +named "data" and create a filesystem: +.Pp +.Dl "gvinum mirror -s -n data /dev/ad1 /dev/ad2 /dev/ad3 /dev/ad4" +.Dl "newfs /dev/gvinum/data" +.Pp +To create a raid5 array on disks /dev/ad1 /dev/ad2 and /dev/ad3, with stripesize +493k you can use the raid5 command: +.Pp +.Dl "gvinum raid5 -s 493k /dev/ad1 /dev/ad2 /dev/ad3" +.Pp +Then the volume will be created automatically. +Afterwards, you have to initialize the volume: +.Pp +.Dl "gvinum start myraid5vol" +.Pp +The initialization will start, and the states will be updated when it's +finished. The list command will give you information about its progress. +.Pp +Imagine that one of the drives fails, and the output of 'printconfig' looks +something like this: +.Pp +.Dl "drive gvinumdrive1 device /dev/ad2" +.Dl "drive gvinumdrive2 device /dev/???" +.Dl "drive gvinumdrive0 device /dev/ad1" +.Dl "volume myraid5vol" +.Dl "plex name myraid5vol.p0 org raid5 986s vol myraid5vol" +.Dl "sd name myraid5vol.p0.s2 drive gvinumdrive2 len 32538s driveoffset 265s" +.Dl "plex myraid5vol.p0 plexoffset 1972s" +.Dl "sd name myraid5vol.p0.s1 drive gvinumdrive1 len 32538s driveoffset 265s" +.Dl "plex myraid5vol.p0 plexoffset 986s" +.Dl "sd name myraid5vol.p0.s0 drive gvinumdrive0 len 32538s driveoffset 265s" +.Dl "plex myraid5vol.p0 plexoffset 0s" +.Pp +Create a new drive with this configuration: +.Pp +.Dl "drive gdrive4 device /dev/ad4" +.Pp +Then move the stale subdisk to the new drive: +.Pp +.Dl "gvinum move gdrive4 myraid5vol.p0.s2" +.Pp +Then, initiate the rebuild: +.Pp +.Dl "gvinum start myraid5vol.p0" +.Pp +The plex will go up form degraded mode after the rebuild is finished. The plex +can still be used while the rebuild is in progress, although requests might be +delayed. For a more advanced usage and detailed explanation of gvinum, the +handbook is recommended. .Sh SEE ALSO .Xr geom 4 , .Xr geom 8 @@ -255,9 +345,13 @@ .An "Chris Jones" through the 2005 Google Summer of Code program. +.Ic a partial rewrite of gvinum was done by "Lukas Ertl" and "Ulf Lilleengen" +through the 2007 Google Summer of Code program. The documentation have been +updated to reflect the new functionality. .Sh AUTHORS .An Lukas Ertl Aq le@FreeBSD.org .An Chris Jones Aq soc-cjones@FreeBSD.org +.An Ulf Lilleengen Aq lulf@FreeBSD.org .Sh BUGS Currently, .Nm @@ -271,10 +365,6 @@ .Ic start is ignored. .Pp -The -.Ic stop -command does not work. -.Pp Moving subdisks that are not part of a mirrored or RAID-5 volume will destroy data. It is perhaps a bug to permit this. @@ -291,18 +381,10 @@ .Xr vinum 4 are not supported: .Bl -tag -width indent -.It Ic attach Ar plex volume Op Cm rename -.It Ic attach Ar subdisk plex Oo Ar offset Oc Op Cm rename -Attach a plex to a volume, or a subdisk to a plex. -.It Ic concat Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives -Create a concatenated volume from the specified drives. .It Ic debug Cause the volume manager to enter the kernel debugger. .It Ic debug Ar flags Set debugging flags. -.It Ic detach Oo Fl f Oc Op Ar plex | subdisk -Detach a plex or subdisk from the volume or plex to which it is -attached. .It Ic dumpconfig Op Ar drive ... List the configuration information stored on the specified drives, or all drives in the system if no drive names are specified. @@ -310,17 +392,9 @@ List information about volume manager state. .It Ic label Ar volume Create a volume label. -.It Ic mirror Oo Fl fsv Oc Oo Fl n Ar name Oc Ar drives -Create a mirrored volume from the specified drives. .It Ic resetstats Oo Fl r Oc Op Ar volume | plex | subdisk Reset statistics counters for the specified objects, or for all objects if none are specified. .It Ic setdaemon Op Ar value Set daemon configuration. -.It Ic stop Oo Fl f Oc Op Ar volume | plex | subdisk -Terminate access to the objects, or stop -.Nm -if no parameters are specified. -.It Ic stripe Oo Fl fv Oc Oo Fl n Ar name Oc Ar drives -Create a striped volume from the specified drives. .El ==== //depot/projects/soc2007/lulf/gvinum_main/sbin/gvinum/gvinum.c#4 (text+ko) ==== @@ -1,5 +1,7 @@ /* - * Copyright (c) 2004 Lukas Ertl, 2005 Chris Jones + * Copyright (c) 2004 Lukas Ertl + * Copyright (c) 2005 Chris Jones + * Copyright (c) 2007 Ulf Lilleengen * All rights reserved. * * Portions of this software were developed for the FreeBSD Project @@ -56,13 +58,16 @@ #include "gvinum.h" void gvinum_attach(int, char **); +void gvinum_concat(int, char **); void gvinum_create(int, char **); void gvinum_detach(int, char **); void gvinum_help(void); void gvinum_list(int, char **); void gvinum_move(int, char **); +void gvinum_mirror(int, char **); void gvinum_parityop(int, char **, int); void gvinum_printconfig(int, char **); +void gvinum_raid5(int, char **); void gvinum_rename(int, char **); void gvinum_resetconfig(void); void gvinum_rm(int, char **); @@ -70,9 +75,15 @@ void gvinum_setstate(int, char **); void gvinum_start(int, char **); void gvinum_stop(int, char **); +void gvinum_stripe(int, char **); void parseline(int, char **); void printconfig(FILE *, char *); +char *create_drive(char *); +void create_volume(int, char **, char *); +char *find_name(const char *, int, int); +char *find_pattern(char *, char *); + int main(int argc, char **argv) { @@ -161,9 +172,9 @@ struct gv_volume *v; FILE *tmp; int drives, errors, fd, line, plexes, plex_in_volume; - int sd_in_plex, status, subdisks, tokens, volumes; + int sd_in_plex, status, subdisks, tokens, undeffd, volumes; const char *errstr; - char buf[BUFSIZ], buf1[BUFSIZ], commandline[BUFSIZ], *ed; + char buf[BUFSIZ], buf1[BUFSIZ], commandline[BUFSIZ], *ed, *sdname; char original[BUFSIZ], tmpfile[20], *token[GV_MAXARGS]; char plex[GV_MAXPLEXNAME], volume[GV_MAXVOLNAME]; @@ -209,7 +220,8 @@ gctl_ro_param(req, "verb", -1, "create"); drives = volumes = plexes = subdisks = 0; - plex_in_volume = sd_in_plex = 0; + plex_in_volume = sd_in_plex = undeffd = 0; + plex[0] = '\0'; errors = 0; line = 1; while ((fgets(buf, BUFSIZ, tmp)) != NULL) { @@ -310,8 +322,16 @@ /* Default name. */ if (strlen(s->name) == 0) { - snprintf(s->name, GV_MAXSDNAME, "%s.s%d", - plex, sd_in_plex++); + if (strlen(plex) == 0) { + sdname = find_name("gvinumsubdisk.p", + GV_TYPE_SD, GV_MAXSDNAME); + snprintf(s->name, GV_MAXSDNAME, + "%s.s%d", sdname, undeffd++); + free(sdname); + } else { + snprintf(s->name, GV_MAXSDNAME, + "%s.s%d",plex, sd_in_plex++); + } } /* Default plex. */ @@ -362,6 +382,223 @@ gctl_free(req); } +/* Create a concatenated volume. */ +void +gvinum_concat(int argc, char **argv) +{ + + if (argc < 2) { + warnx("usage:\tconcat [-fv] [-n name] drives\n"); + return; + } + create_volume(argc, argv, "concat"); +} + + +/* Create a drive quick and dirty. */ +char * +create_drive(char *device) +{ + struct gv_drive *d; + struct gctl_req *req; + const char *errstr; + char *drivename; + int drives, volumes, subdisks, plexes; + + plexes = subdisks = volumes = 0; + drives = 1; + + /* Strip away eventual /dev/ in front. */ + if (strncmp(device, "/dev/", 5) == 0) + device += 5; + + drivename = find_name("gvinumdrive", GV_TYPE_DRIVE, GV_MAXDRIVENAME); + if (drivename == NULL) + return (NULL); + + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + gctl_ro_param(req, "verb", -1, "create"); + d = malloc(sizeof(struct gv_drive)); + if (d == NULL) + err(1, "unable to allocate for gv_drive object"); + memset(d, 0, sizeof(struct gv_drive)); + + strlcpy(d->name, drivename, GV_MAXDRIVENAME); + strlcpy(d->device, device, GV_MAXDRIVENAME); + gctl_ro_param(req, "drive0", sizeof(*d), d); + gctl_ro_param(req, "drives", sizeof(int), &drives); + gctl_ro_param(req, "volumes", sizeof(int), &volumes); + gctl_ro_param(req, "plexes", sizeof(int), &plexes); + gctl_ro_param(req, "subdisks", sizeof(int), &subdisks); + errstr = gctl_issue(req); + if (errstr != NULL) { + warnx("error creating drive: %s", errstr); + gctl_free(req); + free(drivename); + usleep(100000); /* sleep for 0.1s. */ + printf("retrying...\n"); + return (create_drive(device)); + } + gctl_free(req); + return (drivename); +} + +/* + * General routine for creating a volume. Mainly for use by concat, mirror, + * raid5 and stripe commands. + */ +void +create_volume(int argc, char **argv, char *verb) +{ + struct gctl_req *req; + const char *errstr; + char buf[BUFSIZ], *drivename, *volname; + int drives, flags, i; + off_t stripesize; + + flags = 0; + drives = 0; + volname = NULL; + stripesize = 262144; + + /* XXX: Should we check for argument length? */ + + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-f")) { + flags |= GV_FLAG_F; + } else if (!strcmp(argv[i], "-n")) { + volname = argv[++i]; + } else if (!strcmp(argv[i], "-v")) { + flags |= GV_FLAG_V; + } else if (!strcmp(argv[i], "-s")) { + flags |= GV_FLAG_S; + if (!strcmp(verb, "raid5")) + stripesize = gv_sizespec(argv[++i]); + } else { + /* Assume it's a drive. */ + snprintf(buf, sizeof(buf), "drive%d", drives++); + + /* First we create the drive. */ + drivename = create_drive(argv[i]); + if (drivename == NULL) + goto bad; + /* Then we add it to the request. */ + gctl_ro_param(req, buf, -1, drivename); + } + } + + gctl_ro_param(req, "stripesize", sizeof(off_t), &stripesize); + + /* Find a free volume name. */ + if (volname == NULL) + volname = find_name("gvinumvolume", GV_TYPE_VOL, GV_MAXVOLNAME); + + /* Then we send a request to actually create the volumes. */ + gctl_ro_param(req, "verb", -1, verb); + gctl_ro_param(req, "flags", sizeof(int), &flags); + gctl_ro_param(req, "drives", sizeof(int), &drives); + gctl_ro_param(req, "name", -1, volname); + errstr = gctl_issue(req); + if (errstr != NULL) + warnx("creating %s volume failed: %s", verb, errstr); +bad: + gctl_free(req); +} + +/* Parse a line of the config, return the word after <pattern>. */ +char * +find_pattern(char *line, char *pattern) +{ + char *ptr; + + ptr = strsep(&line, " "); + while (ptr != NULL) { + if (!strcmp(ptr, pattern)) { + /* Return the next. */ + ptr = strsep(&line, " "); + return (ptr); + } + ptr = strsep(&line, " "); + } + return (NULL); +} + +/* Find a free name for an object given a a prefix. */ +char * +find_name(const char *prefix, int type, int namelen) +{ + struct gctl_req *req; + char comment[1], buf[GV_CFG_LEN - 1], *name, *sname, *ptr; + const char *errstr; + int i, n, begin, len, conflict; + char line[1024]; + + comment[0] = '\0'; + + /* Find a name. Fetch out configuration first. */ + req = gctl_get_handle(); + gctl_ro_param(req, "class", -1, "VINUM"); + gctl_ro_param(req, "verb", -1, "getconfig"); + gctl_ro_param(req, "comment", -1, comment); + gctl_rw_param(req, "config", sizeof(buf), buf); + errstr = gctl_issue(req); + if (errstr != NULL) { + warnx("can't get configuration: %s", errstr); + return (NULL); + } + gctl_free(req); + + printf(buf); + begin = 0; + len = strlen(buf); + i = 0; + sname = malloc(namelen + 1); + + /* XXX: Max object setting? */ + for (n = 0; n < 10000; n++) { + snprintf(sname, namelen, "%s%d", prefix, n); + conflict = 0; + begin = 0; + /* Loop through the configuration line by line. */ + for (i = 0; i < len; i++) { + if (buf[i] == '\n' || buf[i] == '\0') { + ptr = buf + begin; + strlcpy(line, ptr, (i - begin) + 1); + begin = i + 1; + switch (type) { + case GV_TYPE_DRIVE: + name = find_pattern(line, "drive"); + break; + case GV_TYPE_VOL: + name = find_pattern(line, "volume"); + break; + case GV_TYPE_PLEX: + case GV_TYPE_SD: + name = find_pattern(line, "name"); + break; + default: + printf("Invalid type given\n"); + continue; + } + if (name == NULL) + continue; + if (!strcmp(sname, name)) { + conflict = 1; + /* XXX: Could quit the loop earlier. */ + } + } + } + if (!conflict) + return (sname); + } + free(sname); + return (NULL); +} + /* Detach a plex or subdisk from its parent. */ void gvinum_detach(int argc, char **argv) @@ -412,6 +649,8 @@ "attach plex volume [rename]\n" "attach subdisk plex [offset] [rename]\n" " Attach a plex to a volume, or a subdisk to a plex\n" + "concat [-fv] [-n name] drives\n" + " Create a concatenated volume from the specified drives.\n" "detach [-f] [plex | subdisk]\n" " Detach a plex or a subdisk from the volume or plex to\n" " which it is attached.\n" @@ -425,11 +664,15 @@ " List information about plexes.\n" "lv [-r] [-v] [-V] [volume]\n" " List information about volumes.\n" + "mirror [-fsv] [-n name] drives\n" + " Create a mirrored volume from the specified drives.\n" "move | mv -f drive object ...\n" " Move the object(s) to the specified drive.\n" "quit Exit the vinum program when running in interactive mode." " Nor-\n" " mally this would be done by entering the EOF character.\n" + "raid5 [-fv] [-s stripesize] [-n name] drives\n" + " Create a RAID-5 volume from the specified drives.\n" "rename [-r] [drive | subdisk | plex | volume] newname\n" " Change the name of the specified object.\n" "rebuildparity plex [-f]\n" @@ -447,6 +690,8 @@ " poses only.\n" "start [-S size] volume | plex | subdisk\n" " Allow the system to access the objects.\n" + "stripe [-fv] [-n name] drives\n" + " Create a striped volume from the specified drives.\n" ); return; @@ -572,6 +817,18 @@ return; } +/* Create a mirrored volume. */ +void +gvinum_mirror(int argc, char **argv) +{ + + if (argc < 2) { + warnx("usage\tmirror [-fsv] [-n name] drives\n"); + return; + } + create_volume(argc, argv, "mirror"); +} + /* Note that move is currently of form '[-r] target object [...]' */ void gvinum_move(int argc, char **argv) @@ -685,47 +942,21 @@ if (errstr) warnx("%s\n", errstr); gctl_free(req); -/* do { - rv = 0; - req = gctl_get_handle(); - gctl_ro_param(req, "class", -1, "VINUM"); - gctl_ro_param(req, "verb", -1, "parityop"); - gctl_ro_param(req, "flags", sizeof(int), &flags); - gctl_ro_param(req, "rebuild", sizeof(int), &rebuild); - gctl_rw_param(req, "rv", sizeof(int), &rv); - gctl_rw_param(req, "offset", sizeof(off_t), &offset); - gctl_ro_param(req, "plex", -1, argv[0]); - errstr = gctl_issue(req); - if (errstr) { - warnx("%s\n", errstr); - gctl_free(req); - break; - } - gctl_free(req); - if (flags & GV_FLAG_V) { - printf("\r%s at %s ... ", msg, - gv_roughlength(offset, 1)); - } - if (rv == 1) { - printf("Parity incorrect at offset 0x%jx\n", - (intmax_t)offset); - if (!rebuild) - break; - } - fflush(stdout); +} - Clear the -f flag. - flags &= ~GV_FLAG_F; - } while (rv >= 0);*/ +/* Create a RAID-5 volume. */ +void +gvinum_raid5(int argc, char **argv) +{ -/* if ((rv == 2) && (flags & GV_FLAG_V)) { - if (rebuild) - printf("Rebuilt parity on %s\n", argv[0]); - else - printf("%s has correct parity\n", argv[0]); - }*/ + if (argc < 2) { + warnx("usage:\traid5 [-fv] [-s stripesize] [-n name] drives\n"); + return; + } + create_volume(argc, argv, "raid5"); } + void gvinum_rename(int argc, char **argv) { @@ -960,7 +1191,19 @@ exit(0); } +/* Create a striped volume. */ void +gvinum_stripe(int argc, char **argv) +{ + + if (argc < 2) { + warnx("usage:\tstripe [-fv] [-n name] drives\n"); + return; + } + create_volume(argc, argv, "stripe"); +} + +void parseline(int argc, char **argv) { if (argc <= 0) @@ -974,6 +1217,8 @@ gvinum_attach(argc, argv); else if (!strcmp(argv[0], "detach")) gvinum_detach(argc, argv); + else if (!strcmp(argv[0], "concat")) + gvinum_concat(argc, argv); else if (!strcmp(argv[0], "help")) gvinum_help(); else if (!strcmp(argv[0], "list") || !strcmp(argv[0], "l")) @@ -986,12 +1231,16 @@ gvinum_list(argc, argv); else if (!strcmp(argv[0], "lv")) gvinum_list(argc, argv); + else if (!strcmp(argv[0], "mirror")) + gvinum_mirror(argc, argv); else if (!strcmp(argv[0], "move")) gvinum_move(argc, argv); else if (!strcmp(argv[0], "mv")) gvinum_move(argc, argv); else if (!strcmp(argv[0], "printconfig")) gvinum_printconfig(argc, argv); + else if (!strcmp(argv[0], "raid5")) + gvinum_raid5(argc, argv); else if (!strcmp(argv[0], "rename")) gvinum_rename(argc, argv); else if (!strcmp(argv[0], "resetconfig")) @@ -1006,6 +1255,8 @@ gvinum_start(argc, argv); else if (!strcmp(argv[0], "stop")) gvinum_stop(argc, argv); + else if (!strcmp(argv[0], "stripe")) + gvinum_stripe(argc, argv); else if (!strcmp(argv[0], "checkparity")) gvinum_parityop(argc, argv, 0); else if (!strcmp(argv[0], "rebuildparity")) ==== //depot/projects/soc2007/lulf/gvinum_main/sys/Makefile#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/Makefile,v 1.42 2007/04/14 16:29:15 maxim Exp $ +# $FreeBSD: src/sys/Makefile,v 1.45 2007/07/12 21:04:55 rwatson Exp $ .include <bsd.own.mk> @@ -8,9 +8,9 @@ .endif # Directories to include in cscope name file and TAGS. -CSCOPEDIRS= bsm cam coda compat conf contrib crypto ddb dev fs geom gnu \ +CSCOPEDIRS= bsm cam compat conf contrib crypto ddb dev fs geom gnu \ i4b isa kern libkern modules net net80211 netatalk netatm \ - netgraph netinet netinet6 netipx netkey netnatm netncp \ + netgraph netinet netinet6 netipsec netipx netnatm netncp \ netsmb nfs nfsclient nfs4client rpc pccard pci security sys \ ufs vm ${ARCHDIR} @@ -24,12 +24,14 @@ HTAGSFLAGS+= -at `awk -F= '/^RELEASE *=/{release=$2}; END {print "FreeBSD", release, "kernel"}' < conf/newvers.sh` +# You need the devel/cscope port for this. cscope: ${.CURDIR}/cscopenamefile cd ${.CURDIR}; cscope -k -p4 -i cscopenamefile ${.CURDIR}/cscopenamefile: cd ${.CURDIR}; find ${CSCOPEDIRS} -name "*.[csh]" > ${.TARGET} +# You need the devel/global and one of editor/emacs* ports for that. TAGS ${.CURDIR}/TAGS: ${.CURDIR}/cscopenamefile rm -f ${.CURDIR}/TAGS cd ${.CURDIR}; xargs etags -a < ${.CURDIR}/cscopenamefile ==== //depot/projects/soc2007/lulf/gvinum_main/sys/conf/Makefile.arm#3 (text+ko) ==== @@ -1,7 +1,7 @@ # Makefile.arm -- with config changes. # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD: src/sys/conf/Makefile.arm,v 1.33 2007/05/16 17:23:53 wkoszek Exp $ +# $FreeBSD: src/sys/conf/Makefile.arm,v 1.34 2007/07/27 14:42:25 cognet Exp $ # # Makefile for FreeBSD # @@ -66,23 +66,27 @@ FILES_CPU_FUNC = $S/$M/$M/cpufunc_asm_arm7tdmi.S \ $S/$M/$M/cpufunc_asm_arm8.S $S/$M/$M/cpufunc_asm_arm9.S \ $S/$M/$M/cpufunc_asm_sa1.S $S/$M/$M/cpufunc_asm_arm10.S \ - $S/$M/$M/cpufunc_asm_xscale.S $S/$M/$M/cpufunc_asm.S + $S/$M/$M/cpufunc_asm_xscale.S $S/$M/$M/cpufunc_asm.S \ + $S/$M/$M/cpufunc_asm_xscale_c3.S trampoline: ${KERNEL_KO}.tramp ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > ldscript.$M.tramp sed s/" + SIZEOF_HEADERS"// ldscript.$M.tramp > \ ldscript.$M.tramp.noheader + echo "#include <machine/asm.h>" >tmphack.S + echo "ENTRY(_start)" >>tmphack.S + echo "bl _startC" >>tmphack.S ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \ -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp eval $$(stat -s ${KERNEL_KO}.tmp) && \ echo "#define KERNSIZE $$st_size" >>opt_kernname.h ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp \ - $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S ${FILES_CPU_FUNC} \ - -o ${KERNEL_KO}.tramp + tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ + ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \ - $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o \ - ${KERNEL_KO}.tramp.noheader + tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ + ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \ ${KERNEL_KO}.tramp.bin ${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp @@ -95,15 +99,15 @@ echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h ${CC} -O2 -DKZIP -I. -c $S/kern/inflate.c -o inflate-tramp.o ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp \ - -DKZIP $S/$M/$M/elf_trampoline.c inflate-tramp.o $S/$M/$M/inckern.S \ - ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp + -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \ + $S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \ - -DKZIP $S/$M/$M/elf_trampoline.c inflate-tramp.o $S/$M/$M/inckern.S \ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708032229.l73MTwpk083343>