Received: from eggs.gnu.org ([2001:4830:134:3::10]:48376) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c8DlI-0006Ha-2Y for qemu-devel@nongnu.org; Sat, 19 Nov 2016 17:05:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c8DlG-0004yT-RD for qemu-devel@nongnu.org; Sat, 19 Nov 2016 17:05:28 -0500 References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-6-git-send-email-eblake@redhat.com> From: Max Reitz Message-ID: Date: Sat, 19 Nov 2016 23:05:14 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ot9CmBHOKR6b0bkETjKW4QPvfivMkBRgI" Subject: Re: [Qemu-devel] [PATCH v2 5/9] block: Pass unaligned discard requests to drivers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com, qemu-stable@nongnu.org, Stefan Hajnoczi , Fam Zheng , Peter Lieven This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ot9CmBHOKR6b0bkETjKW4QPvfivMkBRgI From: Max Reitz To: Eric Blake , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com, qemu-stable@nongnu.org, Stefan Hajnoczi , Fam Zheng , Peter Lieven Message-ID: Subject: Re: [PATCH v2 5/9] block: Pass unaligned discard requests to drivers References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-6-git-send-email-eblake@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.11.2016 02:13, Eric Blake wrote: > On 11/17/2016 05:44 PM, Max Reitz wrote: >>> >>> Since the SCSI specification says nothing about a minimum >>> discard granularity, and only documents the preferred >>> alignment, it is best if the block layer gives the driver >>> every bit of information about discard requests, rather than >>> rounding it to alignment boundaries early. >> >> Is this series supposed to address this issue? Because if so, I fail t= o >> see where it does. If the device advertises 15 MB as the discard >> granularity, then the iscsi driver will still drop all discard request= s >> that are not aligned to 15 MB boundaries, no? >> >=20 > I don't have access to the device in question, so I'm hoping Peter > chimes in (oops, how'd I miss him on original CC?). Here's all the mor= e > he said on v1: > https://lists.gnu.org/archive/html/qemu-devel/2016-11/msg02223.html >=20 > My gut feel, however, is that the iscsi code is NOT rounding Why are you relying on your gut feel when you can simply look into the code in question? As a matter of fact, I know that you have looked at the very piece of code in question because you touch it in patch 4. Now that I looked at it again, though, I see my mistake, though: I assumed that is_byte_request_lun_aligned() would check whether the request is aligned to the advertised discard granularity. Of course, it does not, though, it only checks whether it's aligned to the device's block_size. So with the device in question, block_size is something like, say, 1 MB and the pdiscard_alignment is 15 MB. With your series, the block layer will first split off the head of an unaligned discard request (with the rest being aligned to the pdiscard_alignment) and then again the head off that head (with regards to the request_alignment). The iscsi driver will discard the head of the head (which isn't aligned to the request_alignment), but pass the part of the head that is aligned to request_alignment and of course pass everything that's aligned to pdiscard_alignment, too. (And the same then happens for the tail.) OK, now I see. > (the qcow2= > code rounded, but that's different); the regression happened in 2.7 > because the block layer also started rounding, and this patch gets the > block layer rounding out of the way. If nothing changed in the iscsi > code in the meantime, then the iscsi code should now (once again) be > discarding all sizes, regardless of the 15M advertisement. Well, all sizes that are aligned to the request_alignment. > Meanwhile, I _did_ test this patch with blkdebug (see 9/9), as well as > on a slightly modified NBD client that forced 15M alignments, and for > those cases, it definitely made the difference on whether all bytes wer= e > passed (spread across several calls), vs. just the aligned bytes in the= > middle of a request larger than 15M. >=20 >> The only difference is that it's now the iscsi driver that drops the >> request instead of the generic block layer. >=20 > If the iscsi driver was ever dropping it in the first place. It wasn't dropping them, it was asserting that it was dropped; yes, my mistake for thinking that is_byte_request_lun_aligned() would check whether the request is aligned to pdiscard_alignment. Max --ot9CmBHOKR6b0bkETjKW4QPvfivMkBRgI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJYMMyaEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQCZr CACahbdjyndHvBuo4BOM8UmAFvGgIl7iPc/Htivq4O0zZ+qiOfaHlYRMHvPOFeNQ P7t7qaqKq3soGluZlW8i1PZcpKqXy0Yb2SKD9N1naY1tJLLU8OST6zI0aSAwmKS7 WnQLBJugUDKPR4FxIDh5j2mNZuveUtccgDch+GodsFFkoEgbpGW/sapAGdKEn3ec uZ8RODT9nSRz+vBUDFgEKHntAblIfn0Yhg6NA7IdI7uIfewhvwip5p0rOiGYHFkl 4aARG7fgL5IT3EB6vHvufWyAeN0SOZOH4WDWuJnJPzw/klv44RSbZEzDkI38lVuu WfYdzDh6ydEyF6aE3lKLWRNr =Qtv4 -----END PGP SIGNATURE----- --ot9CmBHOKR6b0bkETjKW4QPvfivMkBRgI--