From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqzCn-0006JX-1U for qemu-devel@nongnu.org; Fri, 15 Apr 2016 04:34:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqzCi-0002HQ-S4 for qemu-devel@nongnu.org; Fri, 15 Apr 2016 04:34:20 -0400 Date: Fri, 15 Apr 2016 10:34:09 +0200 From: Kevin Wolf Message-ID: <20160415083409.GC4341@noname.redhat.com> References: <1460545601-29196-1-git-send-email-kwolf@redhat.com> <1460545601-29196-3-git-send-email-kwolf@redhat.com> <57102801.1050303@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="A6N2fC+uXW/VQSAv" Content-Disposition: inline In-Reply-To: <57102801.1050303@redhat.com> 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: Max Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org --A6N2fC+uXW/VQSAv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 15.04.2016 um 01:30 hat Max Reitz geschrieben: > 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. >=20 > You mean it has written null data? :-) >=20 > Alternative version: So it has written zero bytes? Works as intended, the= n. I consciously avoided the latter wording. ;-) > > 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 > > @@ -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); > > } >=20 > Another thing about blk_aio_write_zeroes() that might need fixing is > that it completely ignores its flags parameter. >=20 > 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: Oh dear... Commit 57d6a428 was not my best patch ever, and apparently Stefan wasn't suspicious enough to catch the bugs. Maybe someone should re-review the whole thing... "just" ignoring REQ_MAY_UNMAP is a regression in discard support, so no, that's not what I would call harmless. Definitely needs fixing for 2.6. And we probably need more qtests checking such things. Kevin --A6N2fC+uXW/VQSAv Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXEKeBAAoJEH8JsnLIjy/WwEAQAIwZxlcno95nbYqJ+Trp2JlW XDkSDmd/USesrEnMDGD3COi/Cx4qLhgDC3EgsivFvcBW6Yas94Ck0KxluBQUv2dD a0rxnxpHrCBE/T4QjN1c2Q6MRTlYHQegi/5FRsY/zgGyapRjw6PYDIuKnhnbXecf p4ERM3D8SExpMg0s8RkEuAeAfQJa/SzLYe6MD9uqR7zkaADnmzfiso2LBxN84SYO Es6WOadhFsfc8gJUM96smiQwcvw242NOiugBL9R8reIHh6yaRGSvlhMt7UqGM8TQ CJpFa8Bt1YevHU6LCuF+8/u74J6n3Vm0rbC8Yojxcx9BDmuUyOajDLwvBEy+0Hr3 IKT+gdihxxYXfqnASMv/mIh/Tgvdw7swV3HKzMimZu7zwfbXlsH4OVxybI6Z5IwF CLMVmiwhWk4uycngpF8tXOyWb4XH69wZcKCt1dJnwQyYv69N7eFu9qy0JAlZiJnK VS1zJ//75BmUqBjC7+NAkIj7wKWha9tmV8ssZ2ZZ5KyxCKBFH066V4n0XbZPQYVq hiEEzsv58pc6W098VTmnVmumd3Ki/+uMmzTPiKnYIyRw97pG9DvsyTBWJMaCYwc+ eYiXfoR3pgSLjpA56aaUFfIBsYNg+U4R4pDKWyIXXF/CWwhw5vCiGD6M8QoAoyrx jhwT+fCLeKbU3emf5U4w =f75d -----END PGP SIGNATURE----- --A6N2fC+uXW/VQSAv--