From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqqiJ-0005jU-3R for qemu-devel@nongnu.org; Thu, 14 Apr 2016 19:30:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqqiI-0007x3-8q for qemu-devel@nongnu.org; Thu, 14 Apr 2016 19:30:19 -0400 References: <1460545601-29196-1-git-send-email-kwolf@redhat.com> <1460545601-29196-3-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <57102801.1050303@redhat.com> Date: Fri, 15 Apr 2016 01:30:09 +0200 MIME-Version: 1.0 In-Reply-To: <1460545601-29196-3-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2jRvnFGDwsOHQ6Enk17uWEq0RSeVnOdmW" Subject: Re: [Qemu-devel] [Qemu-block] [PATCH for-2.6 2/2] block: Fix blk_aio_write_zeroes() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2jRvnFGDwsOHQ6Enk17uWEq0RSeVnOdmW Content-Type: multipart/mixed; boundary="2vWMNfXaikLrmL7mt6PDFgOdkSb0aclb0" From: Max Reitz To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org Message-ID: <57102801.1050303@redhat.com> Subject: Re: [Qemu-block] [PATCH for-2.6 2/2] block: Fix blk_aio_write_zeroes() References: <1460545601-29196-1-git-send-email-kwolf@redhat.com> <1460545601-29196-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1460545601-29196-3-git-send-email-kwolf@redhat.com> --2vWMNfXaikLrmL7mt6PDFgOdkSb0aclb0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 13.04.2016 13:06, Kevin Wolf wrote: > Commit 57d6a428 broke blk_aio_write_zeroes() because in some write > functions in the call path don't have an explicit length argument but > reuse qiov->size instead. Which is great, except that write_zeroes > doesn't have a qiov, which this commit interprets as 0 bytes. > Consequently, blk_aio_write_zeroes() didn't effectively do anything. You mean it has written null data? :-) Alternative version: So it has written zero bytes? Works as intended, the= n. >=20 > This patch introduces an explicit acb->bytes in BlkAioEmAIOCB and uses > that instead of acb->rwco.size. >=20 > The synchronous version of the function is okay because it does pass a > qiov (with the right size and a NULL pointer as its base). >=20 > Signed-off-by: Kevin Wolf > --- > block/block-backend.c | 20 +++++++---- > tests/qemu-iotests/033 | 8 +++-- > tests/qemu-iotests/033.out | 82 ++++++++++++++++++++++++++++++++++++++= ++++++++ > 3 files changed, 100 insertions(+), 10 deletions(-) >=20 > diff --git a/block/block-backend.c b/block/block-backend.c > index d74f670..140c3f7 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c [...] > @@ -937,7 +940,8 @@ BlockAIOCB *blk_aio_write_zeroes(BlockBackend *blk,= int64_t sector_num, > return blk_abort_aio_request(blk, cb, opaque, -EINVAL); > } > =20 > - return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS, NULL, > + return blk_aio_prwv(blk, sector_num << BDRV_SECTOR_BITS, > + nb_sectors << BDRV_SECTOR_BITS, NULL, > blk_aio_write_entry, BDRV_REQ_ZERO_WRITE, cb, = opaque); > } Another thing about blk_aio_write_zeroes() that might need fixing is that it completely ignores its flags parameter. That can be done in a seperate patch, however (and is probably not critical, as this currently just means that a potential REQ_MAY_UNMAP from scsi-disk is ignored), so: Reviewed-by: Max Reitz --2vWMNfXaikLrmL7mt6PDFgOdkSb0aclb0-- --2jRvnFGDwsOHQ6Enk17uWEq0RSeVnOdmW 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 iQEcBAEBCAAGBQJXECgBAAoJEDuxQgLoOKytenYH/2M0bXdfnuYGW6Sf1Ki61CKs jJoNPO2yLvq5F1sDe3GP8TBf4hjf4jvCpmEUVlfPba4wGj87JA2OTDUopceB1Myy ZTSqe4WVdrTS0Kgm/2YjViV306XKGfBCRQ5gRLnCRnWg7rW9j2Y/Hcgtlqs6HUpq fZO+0HFOlRjfd228yZ2Q2tMAaR2DehKP+7KmN7wY384RUuWr+JzkStqvRBwRfn4/ ZVCaYqCy2rcL9Stca/ZIue79FW+oWZHopS4V9ia28/Xb2O51RQMk6++xhthZInHP TNyD+hj8aqgGSjjJvZk1P/NN46EvoE0gVxNKskUTSqJ/34xBQCbwFh4vIvN2F/U= =7lC6 -----END PGP SIGNATURE----- --2jRvnFGDwsOHQ6Enk17uWEq0RSeVnOdmW--