From owner-svn-src-projects@FreeBSD.ORG Sun Oct 13 21:26:26 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7B0A19F5; Sun, 13 Oct 2013 21:26:26 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from aslan.scsiguy.com (www.scsiguy.com [70.89.174.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 33F8E2845; Sun, 13 Oct 2013 21:26:25 +0000 (UTC) Received: from [10.0.0.21] (65.105.242.98.ptr.us.xo.net [65.105.242.98]) (authenticated bits=0) by aslan.scsiguy.com (8.14.7/8.14.5) with ESMTP id r9DLQHAn063036 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 13 Oct 2013 15:26:19 -0600 (MDT) (envelope-from gibbs@FreeBSD.org) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: svn commit: r256295 - in projects/camlock/sys: geom kern From: "Justin T. Gibbs" In-Reply-To: <201310102003.r9AK3smQ038364@svn.freebsd.org> Date: Sun, 13 Oct 2013 15:26:12 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <2A8C3ACD-A37E-48CB-9103-DA359B3B0536@FreeBSD.org> References: <201310102003.r9AK3smQ038364@svn.freebsd.org> To: Alexander Motin X-Mailer: Apple Mail (2.1510) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (aslan.scsiguy.com [70.89.174.89]); Sun, 13 Oct 2013 15:26:19 -0600 (MDT) Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Oct 2013 21:26:26 -0000 On Oct 10, 2013, at 2:03 PM, Alexander Motin wrote: > Author: mav > Date: Thu Oct 10 20:03:54 2013 > New Revision: 256295 > URL: http://svnweb.freebsd.org/changeset/base/256295 >=20 > Log: > Use the same satistics for disk and its GEOM provider. >=20 > Avoiding double accounting allows to reduce CPU load on I/O, = especially on > machines with slow timecounter. As side effect it also makes gstat = show > statistics for raw disk providers even when kern.geom.collectstats is = set > to zero, making that mode more usable. =85 > Modified: projects/camlock/sys/geom/geom_io.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- projects/camlock/sys/geom/geom_io.c Thu Oct 10 19:56:31 2013 = (r256294) > +++ projects/camlock/sys/geom/geom_io.c Thu Oct 10 20:03:54 2013 = (r256295) > @@ -510,7 +510,7 @@ g_io_request(struct bio *bp, struct g_co >=20 > KASSERT(!(bp->bio_flags & BIO_ONQUEUE), > ("Bio already on queue bp=3D%p", bp)); > - if (g_collectstats) > + if ((g_collectstats & ~(pp->stat ? 0 : 1)) !=3D 0) > binuptime(&bp->bio_t0); > else > getbinuptime(&bp->bio_t0); This is pretty obscure and further compounds the original bug that there is no enum defining the bits in g_collectstats. Can you please: 1) Add an enum with constants for the two bits in g_collectstats with nice comments for what they do. 2) Use those constants everywhere and change your original logic to make = it more readable? e.g. if ((g_collecstats & G_CONSUMER_STATS) !=3D 0 || ((g_collecstats & G_PROVIDER_STATS) !=3D 0 && pp->stat !=3D = NULL)) I would bet the compiler optimizes this just as well as your original = logic. Thanks, Justin