From owner-freebsd-current@FreeBSD.ORG Thu Jul 14 22:56:20 2005 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B1FB16A41C; Thu, 14 Jul 2005 22:56:20 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B00443D49; Thu, 14 Jul 2005 22:56:20 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.11) with ESMTP id j6EMuIWb057095; Thu, 14 Jul 2005 15:56:18 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id j6EMuGdk057094; Thu, 14 Jul 2005 15:56:16 -0700 (PDT) (envelope-from rizzo) Date: Thu, 14 Jul 2005 15:56:16 -0700 From: Luigi Rizzo To: Scott Long Message-ID: <20050714155616.A56618@xorpc.icir.org> References: <20050705053114.A96381@xorpc.icir.org> <35386.1120575587@phk.freebsd.dk> <20050705103353.A8185@xorpc.icir.org> <20050708110742.A6284@xorpc.icir.org> <20050708203537.H34251@fledge.watson.org> <20050708155827.A10658@xorpc.icir.org> <42D419C2.6040606@samsco.org> <20050712160935.A58434@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20050712160935.A58434@xorpc.icir.org>; from rizzo@icir.org on Tue, Jul 12, 2005 at 04:09:35PM -0700 Cc: s223560@studenti.ing.unipi.it, Robert Watson , current@freebsd.org Subject: Re: location of bioq lock X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2005 22:56:20 -0000 S On Tue, Jul 12, 2005 at 04:09:35PM -0700, Luigi Rizzo wrote: > The approach you suggest in the second part sounds > interesting, except that i have no idea where i should intercept > the calls in the block layer. Any suggestion ? So, rethinking about this oldish thread, you said: > On Tue, Jul 12, 2005 at 01:28:02PM -0600, Scott Long wrote: > ... ... > > An alternate approach that I would suggest is to have the disk scheduler > > freeze the block layer from delivering any new bio's while waiting for > > all of the outstanding bio's to complete, then flip the scheduler > > algorithm and allow i/o delivery to resume. That way there is no > > need to play with driver locks, no need to rummage around in resources > > that are private to the driver, and no need to worry about in-flight > > bio's. It also removes the need to touch every driver with an API > > change. [please correct me if i am wrong] it seems a suitable place would be intercept dev_strategy(bp), however i am not totally clear how i can reach the bioq from there -- geom has a field bp->bio_disk->d_queue, but it does not seem to be universally used, e.g. scsi_da uses bp->bio_disk->d_drv1->softc->bio_queue ata in 5.x uses bp->bio_disk->d_drv1->queue and so on. So if you intercept dev_strategy() you really need to stall I/O until _all_ devices have drained their backlog, because you cannot map the request to the individual bioq :( cheers luigi