Date: Mon, 9 May 2016 11:11:22 -0600 From: Warner Losh <imp@bsdimp.com> To: Alan Somers <asomers@freebsd.org> Cc: Warner Losh <imp@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Steven Hartland <smh@freebsd.org> 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 Message-ID: <925B4FBF-8ECB-4D18-B1D5-ED61F5226B4E@bsdimp.com> In-Reply-To: <CAOtMX2j28M9oTV3BFGkKQ8s5sX1vHBeU-_xeM4GGUBrVdzypYQ@mail.gmail.com> References: <201602171716.u1HHG2c2098316@repo.freebsd.org> <CAOtMX2j28M9oTV3BFGkKQ8s5sX1vHBeU-_xeM4GGUBrVdzypYQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <asomers@freebsd.org> wrote: >=20 >=20 >=20 > On Wed, Feb 17, 2016 at 10:16 AM, Warner Losh <imp@freebsd.org> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?925B4FBF-8ECB-4D18-B1D5-ED61F5226B4E>