From owner-cvs-src@FreeBSD.ORG Fri Sep 5 15:15:23 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 16C6A16A4C0 for ; Fri, 5 Sep 2003 15:15:23 -0700 (PDT) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 98C3844001 for ; Fri, 5 Sep 2003 15:15:21 -0700 (PDT) (envelope-from nate@rootlabs.com) Received: (qmail 72744 invoked by uid 1000); 5 Sep 2003 22:15:22 -0000 Date: Fri, 5 Sep 2003 15:15:22 -0700 (PDT) From: Nate Lawson To: "David G. Lawrence" In-Reply-To: <20030905200502.GB61917@nexus.dglawrence.com> Message-ID: <20030905150357.U72582@root.org> References: <20030905182744.6630916A4E8@hub.freebsd.org> <20030905124936.F72174@root.org> <20030905200502.GB61917@nexus.dglawrence.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.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 X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2003 22:15:23 -0000 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? -Nate