From owner-svn-src-all@freebsd.org Mon May 9 17:11:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D36C2B3457A for ; Mon, 9 May 2016 17:11:25 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pf0-x231.google.com (mail-pf0-x231.google.com [IPv6:2607:f8b0:400e:c00::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A853E1A6E for ; Mon, 9 May 2016 17:11:25 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by mail-pf0-x231.google.com with SMTP id y69so77544088pfb.1 for ; Mon, 09 May 2016 10:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=sender:subject:mime-version:from:in-reply-to:date:cc:message-id :references:to; bh=/UvWhBvK6Lrky817pa/UqZhBmUiBpgKpzgW3wjdrWk0=; b=WFW/RybhHE4x2GW50V4vKIiUjtIvPHSqp+nzfLW2s1zv9XDX/3DaBy4ru+MqUH/V4m dc7gSHiYZGzHdB+Ip8+gi+zuImdu9MT60LbTYAmDOu8Sjy7z88TVt8ydHqMvwgu4jBY1 yaQRVLL4gK1EWBKcOjsQtEh1I9D+Uy2jG0/RSnyTgBr7/TMRoEfqpvNUSrrnPuUuqT8h AY6yATCmJaGOJPqyBtp/cNZXmMn6xT+FehFOuHLDVGV4bO0Z+7MHK06q3ehMQHGm4MH6 FSagqMxel+kHP49G9b1K0IPHa9s4g7kipc0Hu15FksIgA0R5Ke9Un6EzttbY9+gXYJh7 hw/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:from:in-reply-to :date:cc:message-id:references:to; bh=/UvWhBvK6Lrky817pa/UqZhBmUiBpgKpzgW3wjdrWk0=; b=WvprSBul+jj0skRuPnkBjy3tY9n+bukhzd6TF89lF5YhXveJwP21PwQKpTUKoFfd7F Y70NyfaLi0AH63VGtWJSPkiYsDuSY5bmDZfEjRvlHRFGDSDBnM7LbfCh+ITBRS4661+y XIEROb95E513CN9k6glmC/wZHYy/hDZmEyVax5V96FbDdQzDH6Y71mb5CgfI2ioHw0Pm iRGcIhZeugd3sbXYZEiCUaQPbuoNsUrrscKHAW8BHId51JmzjYmyhK83Aacbj8cn6yW2 nxCwfk3H2dVY9H4ylcWSaS87FCqQn6mzVKIbCZKhsQeb2lAF5dG0n3QvjsegW2VYP3e0 Hrxg== X-Gm-Message-State: AOPr4FV57IMcaxCL2XhLxv+qg4WXJj9Fqr9BGOEhNcYLceZJOFFMIfacVtEQrgE+rU40ng== X-Received: by 10.98.29.137 with SMTP id d131mr51879291pfd.2.1462813885054; Mon, 09 May 2016 10:11:25 -0700 (PDT) Received: from [100.127.71.31] ([69.53.245.200]) by smtp.gmail.com with ESMTPSA id q70sm41879585pfj.81.2016.05.09.10.11.23 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 May 2016 10:11:24 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r295707 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs dev/mmc dev/virtio/block geom geom/journal geom/mirror geom/raid geom/raid3 kern Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Content-Type: multipart/signed; boundary="Apple-Mail=_E7D17DCA-890A-42B9-82A8-D5DCC2053069"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5.2 From: Warner Losh In-Reply-To: Date: Mon, 9 May 2016 11:11:22 -0600 Cc: Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Steven Hartland Message-Id: <925B4FBF-8ECB-4D18-B1D5-ED61F5226B4E@bsdimp.com> References: <201602171716.u1HHG2c2098316@repo.freebsd.org> To: Alan Somers X-Mailer: Apple Mail (2.2104) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2016 17:11:25 -0000 --Apple-Mail=_E7D17DCA-890A-42B9-82A8-D5DCC2053069 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 9, 2016, at 11:04 AM, Alan Somers wrote: >=20 >=20 >=20 > On Wed, Feb 17, 2016 at 10:16 AM, Warner Losh wrote: > Author: imp > Date: Wed Feb 17 17:16:02 2016 > New Revision: 295707 > URL: https://svnweb.freebsd.org/changeset/base/295707 >=20 > Log: > Create an API to reset a struct bio (g_reset_bio). This is mandatory > for all struct bio you get back from g_{new,alloc}_bio. Temporary > bios that you create on the stack or elsewhere should use this = before > first use of the bio, and between uses of the bio. At the moment, it > is nothing more than a wrapper around bzero, but that may change in > the future. The wrapper also removes one place where we encode the > size of struct bio in the KBI. >=20 > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > head/sys/dev/mmc/mmcsd.c > head/sys/dev/virtio/block/virtio_blk.c > head/sys/geom/geom.h > head/sys/geom/geom_io.c > head/sys/geom/journal/g_journal.c > head/sys/geom/mirror/g_mirror.c > head/sys/geom/raid/g_raid.c > head/sys/geom/raid3/g_raid3.c > head/sys/kern/kern_physio.c >=20 > smh noticed that while your commit message says that g_reset_bio is = mandatory after g_{new,alloc}_bio, your diff only replaced existing = calls to bzero. You didn't insert g_reset_bio calls after all = g_alloc_bio calls, for example in vdev_geom_io_start. Do you intend to = follow up this change with a g_reset_bio everywhere that g_alloc_bio is = called, or did you mean that g_reset_bio is optional after all bios = returned by g_{new,alloc}_bio? g_reset_bio is required when you reuse the bio returned from = g_{new,alloc}_bio. You don=E2=80=99t need to reset it before using it. = Only when reusing it where you used to call bzero(). My commit message = is at best ambiguous: g_reset_bio() is required to reuse the bio, not to = use it in the first place. So all callers to g_alloc_bio() that just use = the bio then return it don=E2=80=99t need to change. Callers to = g_alloc_bio() that use the bio for multiple I/Os need to call = g_reset_bio() between uses of the bio. That=E2=80=99s why I only changed = the bzero=E2=80=99s in the tree: those were the only places where the = bio was being re-used. Otherwise you wouldn=E2=80=99t need to reset the = bio, since it is returned =E2=80=98set=E2=80=99 from g_{new,alloc}_bio. = Before some other changes I have, it was safe to assume no fields needed = to be preserved when you wanted to reuse the bio for multiple I/Os, so = the code just used bzero(). After that change, the code needn=E2=80=99t = assume what you need to do to a bio to reuse it, other than call this = API. In the future, there may be info about which uma pool the I/O came = from so we can have a small reserve of bios for low/out of memory = situations to allow them to clear more quickly. Sorry if things were unclear. Hopefully they are clear now. Warner --Apple-Mail=_E7D17DCA-890A-42B9-82A8-D5DCC2053069 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJXMMS6AAoJEGwc0Sh9sBEADq0P/A6Rnu0Gr+yfrh6cWOiI1boT 59ect/pvI5byTWxiQb40idR2iNWO/xl/+bH4iY4dchIGG0rzY2kTQ9t6bxXG7dy5 4WmBeMz8l7B8j/BHOqjaDucPEOxUEHjpqaCbXN840IbXzbuXXeduki4r9WXP4th4 I1B5ErzU+7qSZ9CxYX5gPxcQkxig5VT5nZhzM3Fd2YsitEYwCRHE4EgcKiXNyYsw h5qt3aBKgibFB5Dbd6srO+B5+DOI0scjazrXI1SW/mizUizrhdfRm94YEHqJ3SsW H+EftBGJXDhFVx1lBbCeRGvy6NF9qR27oqtnM+UNTfBy/xb0SI/l5ublm0MWoERz cI7uiWsp8j4TB0s/m9+VNUui6JXSOVKZaPjd6qRJ/5VMNGGStAuIR6N2P1PlK2N3 Wa2oq1q5knxgvmsffwz+lzbqEjHv1VbNLzUYyPNcoOY57J00+GR3srRh/JQpRE2k 2JWom2gK28NEhAFQT5p0h6OzOavrrGdaO65/yCjWsEs1pDEkLfP5o/s+75wncPvQ hBlWLkvd1l4ILtz5bjTLyYrw6/MdqXrZZmTDTQ68XYjSosGwRXLYqau0PPUav60I pSxf/w7Xt1tRf43rGXRlUQ9b62FPhPd6A/0ix7cv2hahH7jCbIjjkkBmtE4izAbj mt5S42z+UKph8fPad/Gz =Ebww -----END PGP SIGNATURE----- --Apple-Mail=_E7D17DCA-890A-42B9-82A8-D5DCC2053069--