Date: Fri, 5 Sep 2003 16:05:48 -0700 From: "David G. Lawrence" <dg@dglawrence.com> To: Nate Lawson <nate@root.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/ata ata-all.c ata-disk.c ata-disk.h atapi-all.c atapi-all.h Message-ID: <20030905230548.GC61917@nexus.dglawrence.com> In-Reply-To: <20030905150357.U72582@root.org> References: <20030905182744.6630916A4E8@hub.freebsd.org> <20030905124936.F72174@root.org> <20030905200502.GB61917@nexus.dglawrence.com> <20030905150357.U72582@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Fri, 5 Sep 2003, David G. Lawrence wrote: > > Nate Lawson wrote: > > > Yikes, invasive. Is there a way to do a "if (held(lock))" construct > > > instead? > > > > What do you mean by invasive? > > Changing all the callers to pass a flag whether or not they hold the lock. > I'm not experienced with what the best accepted approach to locking is. > However, it seems like locks should not require external information (i.e. > hints) or recursion generally. I understand this is not an OS lock but an > ATA lock but it seems like the same principle would apply. My question is > whether there is a way the call path can be changed so that the flag is > implicit or for the exception case there is a way to query the lock to see > if it's already held. Would such an approach be feasible? Unfortunately not. If you only aquire the lock when there isn't one, then there isn't much point in doing it in the first place. :-) The real problem is a layering violation, but it is difficult to fix and beyond the scope of what can be done in -stable. -DG David G. Lawrence Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500 TeraSolutions, Inc. - http://www.terasolutions.com - (888) 346 7175 The FreeBSD Project - http://www.freebsd.org Pave the road of life with opportunities.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030905230548.GC61917>