From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDYAp-0003Ev-Mt for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:21:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDYAn-00047O-Gg for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:21:34 -0400 References: <1465939839-30097-1-git-send-email-eblake@redhat.com> <1465939839-30097-16-git-send-email-eblake@redhat.com> <20160616054657.GQ12178@ad.usersys.redhat.com> From: Eric Blake Message-ID: <5762B5E4.80400@redhat.com> Date: Thu, 16 Jun 2016 08:21:24 -0600 MIME-Version: 1.0 In-Reply-To: <20160616054657.GQ12178@ad.usersys.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ow2pce3gAT4DnM8DStbjN6bIkglnfLE3U" Subject: Re: [Qemu-devel] [PATCH v2 15/17] 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, Stefan Hajnoczi , Max Reitz , Ronnie Sahlberg , Paolo Bonzini , Peter Lieven This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Ow2pce3gAT4DnM8DStbjN6bIkglnfLE3U Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/15/2016 11:46 PM, Fam Zheng wrote: > On Tue, 06/14 15:30, 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. In iscsi.c, sector_limits_lun2qemu() >> is no longer needed; and the BlockLimits type is now completely >> byte-based. >> >> Signed-off-by: Eric Blake >> >> >> typedef struct BlockLimits { >> - /* maximum number of sectors that can be discarded at once */ >> - int max_discard; >> + /* maximum number of bytes that can be discarded at once (since i= t >> + * is signed, it must be < 2G, if set), should be multiple of >> + * pdiscard_alignment, but need not be power of 2. May be 0 if no= >> + * inherent 32-bit limit */ >> + int32_t max_pdiscard; >=20 > Why not use uint32_t? >=20 >> >> - /* 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 >> + * bs->request_alignment. May be 0 if bs->request_alignment is >> + * good enough */ >> + uint32_t pdiscard_alignment; >> >> /* maximum number of bytes that can zeroized at once (since it is= >> - * signed, it must be < 2G, if set) */ >> + * signed, it must be < 2G, if set), should be multiple of >> + * pwrite_zeroes_alignment. May be 0 if no inherent 32-bit limit = */ >> int32_t max_pwrite_zeroes; Because max_pwrite_zeroes didn't. And because we're still limited by INT_MAX (or it's alternative spelling BDRV_REQUEST_MAX_SECTORS). Maybe we should switch both to uint32_t, but that can be a followup. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Ow2pce3gAT4DnM8DStbjN6bIkglnfLE3U 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/ iQEcBAEBCAAGBQJXYrXkAAoJEKeha0olJ0Nqb7MIAJsMSLrIoAelgmsLumaxbARZ jqKb5ulwyPK9bmjlQRSrLYHnkoPrs83hcGYfh3nsxLAghRu7BJk3XslI+pGeFHNa nwBObN1/QsPLc+1tQxwIYqN6EDqCC2wCU2bmSsq0ypKP5HZRStd3fL+XM/PduxKB IxA1tWqCcexeP61rgS7yZqktspAG+dsqTFibo+8WRB+B27J3XS8DNdXco+qQLRZh Vg5fTTNaPeI26S+pjCBshobsmzmlaCiKyzayr21Z7CgMEjTm2PmUf05Pc8otFR/k dXLtI5B8i0aW6ZFXqgqthMlKNGksYrZL+44yAo8tKMcbvetdvaLVbYfWAxBa100= =1ID3 -----END PGP SIGNATURE----- --Ow2pce3gAT4DnM8DStbjN6bIkglnfLE3U--