Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2001 11:18:01 +1000
From:      Greg Lehey <grog@FreeBSD.org>
To:        Bill Moran <wmoran@iowna.com>
Cc:        Drew Derbyshire <ahd@kew.com>, questions@FreeBSD.org
Subject:   Re: Stopping / removing vinum segments
Message-ID:  <20010624111801.A605@sydney.worldwide.lemis.com>
In-Reply-To: <3B351F6B.27A6C1DB@iowna.com>; from wmoran@iowna.com on Sat, Jun 23, 2001 at 06:59:55PM -0400
References:  <3B2C2B84.8792D238@iowna.com> <000801c0f72b$f25931c0$94cba8c0@xena> <3B2CC068.2A0B6C01@iowna.com> <000801c0f748$ab47a880$94cba8c0@xena> <20010619112338.C58585@wantadilla.lemis.com> <002801c0fa6c$3d0f78d0$94cba8c0@xena> <20010622132151.X57186@wantadilla.lemis.com> <3B32C5BE.D388DCF9@iowna.com> <20010622135015.Z57186@wantadilla.lemis.com> <3B351F6B.27A6C1DB@iowna.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday, 23 June 2001 at 18:59:55 -0400, Bill Moran wrote:
> Greg Lehey wrote:
>>> Makes sense now (didn't before)
>>> Perhaps a more informative error message under these circumstances would
>>> be helpful? Something to the effect of: "Detaching will destroy data!
>>> Use -f if you're sure."
>>
>> Yes, this would be a good idea.  If somebody wants to write the code,
>> I'll include it.
>
> Well, I took that statement to heart and started digging into the source
> code (hoping I would be able to understand it)
> While I haven't given up yet, code at this level looks pretty magic to
> me. I haven't even figured out where to start tweaking yet. Basically
> what I'm asking is for any references to get me started on understanding
> the vinum code. At a low level it seems pretty well documented, but I'm
> looking for a broader explanation. Something like "File xxx.c contains
> routines for foo, file yyy.c contains routines for doing bar."
> This is not guarantee that I'm at the point where I can figure this out.
> But as I said before, I'm not ready to give up yet.

OK.  The code really isn't that magical.  Look in
/usr/src/sys/dev/vinum/vinumvar.h for definitions of the primary
objects (struct sd, plex and vol).  The function detachobject() is in
/usr/src/sys/dev/vinum/vinumioctl.c.  You need to look at the object
and decide whether removing it will cause the volume to lose data.
Off the top of my head, I can think of a couple of scenarios:

1.  volume with two or more plexes.  Remove is OK if another plex
    covers the area you're removing, not otherwise.
2.  plex not part of a volume.  OK.

Reading the code you may find more.  The error return is special: in
order to be able to return error strings, you need the ioctl() to
return no error, and the reply contains an error number and a text.
Currently I have things like:

	if (sd->plexno < 0) {				    /* doesn't belong to a plex */
	    reply->error = ENOENT;
	    strcpy(reply->msg, "Subdisk is not attached");
	    return;

You can think of appropriate other texts.  Let me know (offline) if
you need more info.

Greg
--
When replying to this message, please copy the original recipients.
If you don't, I may ignore the reply.
For more information, see http://www.lemis.com/questions.html
See complete headers for address and phone numbers

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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