Patch to allow gmirror to set priority of a disk

Mel Flynn mel.flynn+fbsd.fs at mailing.thruhere.net
Thu Sep 3 13:48:42 UTC 2009


On Thursday 03 September 2009 14:44:07 Pawel Jakub Dawidek wrote:
> On Thu, Sep 03, 2009 at 12:00:11AM +0200, Mel Flynn wrote:

> > Unfortunately, due to geographic relocation, I no longer have physical
> > access to the machine, so I have only compile tested this patch, but I
> > wanted to get some feedback about it:
> > - Have I made some mistakes that would trash my mirror? ;)
> > - Is there any desire to have this feature other then my own?
> > - Any style issues?
>
> Thank you for working on this, this is a long missing bit, although I've
> some comments.
>
> You assume that you can write to the mirror component, so you also
> assume that your mirror if offline, because if it would be online you
> won't be able to write to one of its components.

Ah, that's a gotcha I didn't catch.

> So what we need more is to be able to change priority of a mirror
> component which is part of an online mirror, so we need to comunicate
> with the kernel.  Would you like to implement this functionality this
> way?

Yes.

> I'd suggest doing this not as separate gmirror(8) subcommand, but as an
> extension to 'configure' subcommand, where one can provide priority by
> giving '-p' argument.

Except I didn't see how configure was implemented. Am I correct that this is 
g_mirror_ctl_configure in sys/geom/mirror/g_mirror_ctl.c?

> PS. In case of 'gmirror insert' you already can change the priority with
>     the '-p' option.

Right. Dunno how I missed that.

On a related note, perhaps the attached can be applied so that there's no 
question about the priority numbering?
-- 
Mel
-------------- next part --------------
Index: sbin/geom/class/mirror/gmirror.8
===================================================================
--- sbin/geom/class/mirror/gmirror.8	(revision 196776)
+++ sbin/geom/class/mirror/gmirror.8	(working copy)
@@ -115,8 +115,8 @@
 .It Cm label
 Create a mirror.
 The order of components is important, because a component's priority is based on its position
-(starting from 0).
-The component with the biggest priority is used by the
+(starting from 0 to 255).
+The component with the biggest priority (the lowest number) is used by the
 .Cm prefer
 balance algorithm
 and is also used as a master component when resynchronization is needed,


More information about the freebsd-fs mailing list