Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jun 2003 11:50:32 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        current@freebsd.org
Subject:   Re: GEOM_FOX
Message-ID:  <38179.1055929832@critter.freebsd.dk>
In-Reply-To: Your message of "Wed, 18 Jun 2003 02:29:28 PDT." <200306180929.h5I9TSXZ086252@repoman.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help

I have just committed the GEOM_FOX class, see commit message below.

GEOM_FOX is named after the common red fox, which amongst other
traits have a liking for having multiple exits from its den.

GEOM_FOX will recognize a magic label on the device, and all devices
which come up with the same label will be assumed to be independent
paths to the same underlying physical device.

The first device found will name the created redundant device (I
need to work on that aspect because it makes the name a bit
unpredicatable right now).

If the currently used path to the device fails, GEOM_FOX will switch
to another path and retry the operation.

For anyone who wants to play with this, the following shell script
could be a beginning.  It exploits the fact that the same file can
be used to back several MD(4) devices, so you need no special
hardware.

This will probably be most interesting for people with FibreChannel/SAN
hardware, but since the isp driver has very aggresive retrie policies
as it is now, the actual usability is still somewhat below par.
I'm sure both mjacob an I would appreciate any help we can get in
fixing this.


	#!/bin/sh

	set -ex

	# cleanup
	mdconfig -d -u 10 > /dev/null 2>&1 || true
	mdconfig -d -u 20 > /dev/null 2>&1 || true
	kldunload geom_fox > /dev/null 2>&1 || true

	# Create a 4M disk image
	dd if=/dev/zero of=fox.img bs=1k count=4096

	# create a "disk" on it.
	mdconfig -a -t vnode -f fox.img -u 10

	# Put the GEOM::FOX label on it
	echo "GEOM::FOX       test-fox" | dd of=/dev/md10 conv=sync

	# load the geom_fox module
	kldload geom_fox

	# add another path
	mdconfig -a -t vnode -f fox.img -u 20

	# remove it again
	mdconfig -d -u 20

	# add it again
	mdconfig -a -t vnode -f fox.img -u 20

	# remove the original path
	mdconfig -d -u 10

	# add it again
	mdconfig -a -t vnode -f fox.img -u 10

	# newfs the "fox"
	newfs /dev/md10.fox

	# fsck it
	fsck_ffs /dev/md10.fox

	# remove the currently primary path
	mdconfig -d -u 20

	# fsck it again
	fsck_ffs /dev/md10.fox

	# add a new secondary path
	mdconfig -a -t vnode -f fox.img -u 30

	# remove the primary 
	mdconfig -d -u 10

	# fsck it again
	fsck_ffs /dev/md10.fox

	# Remove the primary and only path
	mdconfig -d -u 30

	# See what's left (hopefully nothing)
	ls -l /dev/md*




In message <200306180929.h5I9TSXZ086252@repoman.freebsd.org>, Poul-Henning Kamp w
rites:
>phk         2003/06/18 02:29:28 PDT
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/modules/geom     Makefile 
>    sys/conf             NOTES files options 
>  Added files:
>    sys/geom             geom_fox.c 
>    sys/modules/geom/geom_fox Makefile 
>  Log:
>  Add "GEOM_FOX", a class which detects and selects between multiple
>  redundant paths to the same device.
>  
>  This class reacts to a label in the first sector of the device,
>  which is created the following way:
>  
>          #    "0123456789abcdef012345..."
>          #    "<----magic-----><-id-...>
>          echo "GEOM::FOX       someid" | dd of=/dev/da0 conv=sync
>  
>  NB: Since the fact that multiple disk devices are in fact the same
>      device is not known to GEOM, the geom taste/spoil process cannot
>      fully catch all corner cases and this module can therefore be
>      confused if you do the right wrong things.
>  
>  NB: The disk level drivers need to do the right thing for this to
>      be useful, and that is not by definition currently the case.
>  
>  Revision  Changes    Path
>  1.1153    +1 -0      src/sys/conf/NOTES
>  1.795     +1 -0      src/sys/conf/files
>  1.395     +1 -0      src/sys/conf/options
>  1.1       +468 -0    src/sys/geom/geom_fox.c (new)
>  1.4       +1 -0      src/sys/modules/geom/Makefile
>  1.1       +8 -0      src/sys/modules/geom/geom_fox/Makefile (new)
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38179.1055929832>