From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGRto-0006I6-QK for qemu-devel@nongnu.org; Fri, 24 Jun 2016 10:16:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGRtn-0004Om-LF for qemu-devel@nongnu.org; Fri, 24 Jun 2016 10:16:00 -0400 References: <1466721446-27737-1-git-send-email-eblake@redhat.com> <1466721446-27737-18-git-send-email-eblake@redhat.com> <20160624064310.GC13266@ad.usersys.redhat.com> From: Eric Blake Message-ID: <576D4099.2020108@redhat.com> Date: Fri, 24 Jun 2016 08:15:53 -0600 MIME-Version: 1.0 In-Reply-To: <20160624064310.GC13266@ad.usersys.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tQLQ69r4ouFSI9RvM0gB6NMlpcjdUncdc" Subject: Re: [Qemu-devel] [PATCH v3 17/22] block: Switch discard length bounds to byte-based List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, kwolf@redhat.com, stefanha@redhat.com, Max Reitz , Ronnie Sahlberg , Paolo Bonzini , Peter Lieven This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tQLQ69r4ouFSI9RvM0gB6NMlpcjdUncdc From: Eric Blake To: Fam Zheng Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, kwolf@redhat.com, stefanha@redhat.com, Max Reitz , Ronnie Sahlberg , Paolo Bonzini , Peter Lieven Message-ID: <576D4099.2020108@redhat.com> Subject: Re: [PATCH v3 17/22] block: Switch discard length bounds to byte-based References: <1466721446-27737-1-git-send-email-eblake@redhat.com> <1466721446-27737-18-git-send-email-eblake@redhat.com> <20160624064310.GC13266@ad.usersys.redhat.com> In-Reply-To: <20160624064310.GC13266@ad.usersys.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/24/2016 12:43 AM, Fam Zheng wrote: > On Thu, 06/23 16:37, Eric Blake wrote: >> Sector-based limits are awkward to think about; in our on-going >> quest to move to byte-based interfaces, convert max_discard and >> discard_alignment. Rename them, using 'pdiscard' as an aid to >> track which remaining discard interfaces need conversion, and so >> that the compiler will help us catch the change in semantics >> across any rebased code. The BlockLimits type is now completely >> byte-based; and in iscsi.c, sector_limits_lun2qemu() is no >> longer needed. >> >> pdiscard_alignment is made unsigned (we use power-of-2 alignments >> as bitmasks, where unsigned is easier to think about) while >> leaving max_pdiscard signed (since we still have an 'int' >> interface); this is comparable to what commit cf081fc did for >> write zeroes limits. We may later want to make everything an >> unsigned 64-bit limit - but that requires a bigger code audit. >> >> - /* optimal alignment for discard requests in sectors */ >> - int64_t discard_alignment; >> + /* optimal alignment for discard requests in bytes, must be power= >> + * of 2, less than max_discard if that is set, and multiple of >=20 > s/max_discard/max_pdiscard/ Maintainer could touch it up on pull request. >> /* align request */ >> - if (bs->bl.discard_alignment && >> - num >=3D bs->bl.discard_alignment && >> - sector_num % bs->bl.discard_alignment) { >> - if (num > bs->bl.discard_alignment) { >> - num =3D bs->bl.discard_alignment; >> + if (discard_alignment && >> + num >=3D discard_alignment && >> + sector_num % discard_alignment) { >> + if (num > discard_alignment) { >> + num =3D discard_alignment; >> } >> - num -=3D sector_num % bs->bl.discard_alignment; >> + num -=3D sector_num % discard_alignment; >=20 > Or just >=20 > num =3D discard_alignment - sector_num % discard_alignme= nt; >=20 > without the if. >=20 Sure. It all gets simplified later when I switch to bdrv_co_pdiscard(). Up to the maintainer. > Otherwise looks good, >=20 > Reviewed-by: Fam Zheng >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --tQLQ69r4ouFSI9RvM0gB6NMlpcjdUncdc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXbUCZAAoJEKeha0olJ0Nq43UH/2I76S/eaDdlooucnSgY3xIZ OkONit6eBGGy8EhpFKSDhKmM1a58ARcNK994/ZClMYjSeTH0mISormw0HNZ+wlkK dklXKAaF7ehp3mol5TVcJal3v9OK/5EHxmkt3D/Tq8/HHVxsPnV32CDq/3hd2cXB LRp2Ry8UBXwgks6BrgmePcGuuoGg6Z8l5q0HCsgh8fDpimbBVYnBdAPuX43ijAz7 VNpi71zgfOBZvLUrxg81bNUtLFYYPXAb2fDtj8TBbwAgDOX333NmqTDRNSWpPIpw ehYuoJBVgyeHumbVQzjdcQL4soBugYSpEutz2sc9AvbQ5IU8BWuZhYVnNxfm1fI= =bf+o -----END PGP SIGNATURE----- --tQLQ69r4ouFSI9RvM0gB6NMlpcjdUncdc--