From: Eric Blake Subject: Re: [Qemu-devel] [PATCH] xen_disk: convert discard input to byte ranges Date: Fri, 18 Nov 2016 08:35:06 -0600 Message-ID: <3b7a53ed-10e1-e733-7454-d5ee38761da0@redhat.com> References: <20161118102452.5779-1-olaf@aepfle.de> <5aa0cd45-0c73-b940-81e1-235625a428a2@redhat.com> <37C38B91-CDF7-443F-A517-3D16187B2A1F@aepfle.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="EmTpVh4iIUUV5W4TSA19v4wgRM7JtSjiA" Return-path: In-Reply-To: <37C38B91-CDF7-443F-A517-3D16187B2A1F@aepfle.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-block-bounces+gceqb-qemu-block=m.gmane.org@nongnu.org Sender: "Qemu-block" To: Olaf Hering , qemu-block@nongnu.org Cc: Kevin Wolf , "open list:X86" , "open list:All patches CC here" , Max Reitz , Stefano Stabellini , Anthony Perard List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --EmTpVh4iIUUV5W4TSA19v4wgRM7JtSjiA Content-Type: multipart/mixed; boundary="0CFTK0XOc3gOvofAgjo8RvvpebrF9UhWs"; protected-headers="v1" From: Eric Blake To: Olaf Hering , qemu-block@nongnu.org Cc: Kevin Wolf , Stefano Stabellini , "open list:All patches CC here" , Max Reitz , "open list:X86" , Anthony Perard Message-ID: <3b7a53ed-10e1-e733-7454-d5ee38761da0@redhat.com> Subject: Re: [Qemu-devel] [PATCH] xen_disk: convert discard input to byte ranges References: <20161118102452.5779-1-olaf@aepfle.de> <5aa0cd45-0c73-b940-81e1-235625a428a2@redhat.com> <37C38B91-CDF7-443F-A517-3D16187B2A1F@aepfle.de> In-Reply-To: <37C38B91-CDF7-443F-A517-3D16187B2A1F@aepfle.de> --0CFTK0XOc3gOvofAgjo8RvvpebrF9UhWs Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/18/2016 08:19 AM, Olaf Hering wrote: > Am 18. November 2016 14:43:18 MEZ, schrieb Eric Blake : >> On 11/18/2016 04:24 AM, Olaf Hering wrote: >>> The guest sends discard requests as u64 sector/count pairs, but the >>> block layer operates internally with s64/s32 pairs. The conversion >>> leads to IO errors in the guest, the discard request is not >> processed. >> >> Doesn't the block layer already split discard requests into 2^31 byte >> chunks? >=20 > How would it do that without valid input? It was wrong before the sect= ors to bytes conversion, and now its even worse given that all the world = fits into an int. Then it sounds like the real bug is that the block layer bdrv_co_pdiscard() is buggy for taking 'int count' instead of 'uint64_t count'. Eventually, I think the entire block layer should be fixed to allow 64-bit count everywhere, and then auto-fragment it back down to 31 bits (or even smaller, like NBD's 32M limit or Linux loopback device 64k limit) as needed, rather than making all the backends reimplement fragmentation. >=20 > Remember that there is no API to let the guest know about the limitatio= ns of the host.=20 Correct. But the goal of the block layer is to hide the quirks, so that the code handling the guest requests can offload all the common work to one place. Kevin, is it too late for 2.8 for patches that change bdrv_co_pdiscard to take a 64-bit count? Or would that still be under bug-fix category because of the xen use case? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --0CFTK0XOc3gOvofAgjo8RvvpebrF9UhWs-- --EmTpVh4iIUUV5W4TSA19v4wgRM7JtSjiA 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/ iQEcBAEBCAAGBQJYLxGaAAoJEKeha0olJ0Nqz8kIAJr0R9AlHaOvzFMvwqr94CJ7 1zM8UVYZwy7M7rqwiY40qO4DC9VYVBoynhmyAVTKCgOq+188WSdTYxc55PLYQrGP uGooqv+zuUwAXchEuvVlafPazyaKmvUi6lPtezVldDQ7icR5H/lC7QazHafi11o7 HxYBK/rr9Lw7OBpJCLVfoDh0choORXb0FZSUUU6QwRF75JpdeoiF3m37Chb8VGB8 FgqG0qFoas/pA4Krw7HcncHYnXzsoJav4Ij2s3w8T/RXBsfUWYx/0epM89h6d0wR bB9bSH9LBDrHAzNro3o/FtUBrTFsVdT/W7lQ6oen7Sd2jDULEnJ6b7sF5M2MI3I= =1uaB -----END PGP SIGNATURE----- --EmTpVh4iIUUV5W4TSA19v4wgRM7JtSjiA--