From owner-freebsd-questions Mon Jun 25 7:51:34 2001 Delivered-To: freebsd-questions@freebsd.org Received: from firefly.lemis.com (firefly.lemis.com [192.109.197.244]) by hub.freebsd.org (Postfix) with ESMTP id EC3F637B40D for ; Mon, 25 Jun 2001 07:50:53 -0700 (PDT) (envelope-from grog@firefly.lemis.com) Received: (from grog@localhost) by sydney.worldwide.lemis.com (8.11.3/8.9.3) id f5O1JIa00638; Sun, 24 Jun 2001 11:19:18 +1000 (EST) (envelope-from grog) Date: Sun, 24 Jun 2001 11:18:01 +1000 From: Greg Lehey To: Bill Moran Cc: Drew Derbyshire , questions@FreeBSD.org Subject: Re: Stopping / removing vinum segments Message-ID: <20010624111801.A605@sydney.worldwide.lemis.com> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <3B351F6B.27A6C1DB@iowna.com>; from wmoran@iowna.com on Sat, Jun 23, 2001 at 06:59:55PM -0400 Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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