Received: from eggs.gnu.org ([2001:4830:134:3::10]:42993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9B1o-0004iT-5j for qemu-devel@nongnu.org; Tue, 22 Nov 2016 08:22:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9B1i-0006ws-9H for qemu-devel@nongnu.org; Tue, 22 Nov 2016 08:22:28 -0500 References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-4-git-send-email-eblake@redhat.com> <20161122131653.GD5615@noname.redhat.com> From: Eric Blake Message-ID: <69447b54-f0ea-de74-ea9b-5184c44bddc8@redhat.com> Date: Tue, 22 Nov 2016 07:22:11 -0600 MIME-Version: 1.0 In-Reply-To: <20161122131653.GD5615@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ixtdoHPFLaHFClxj3ngBcSF9ug19eQ7wR" Subject: Re: [Qemu-devel] [PATCH v3 3/9] block: Let write zeroes fallback work even with small max_transfer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, pbonzini@redhat.com, qemu-stable@nongnu.org, "Denis V . Lunev" , Stefan Hajnoczi , Fam Zheng , Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ixtdoHPFLaHFClxj3ngBcSF9ug19eQ7wR From: Eric Blake To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, pbonzini@redhat.com, qemu-stable@nongnu.org, "Denis V . Lunev" , Stefan Hajnoczi , Fam Zheng , Max Reitz Message-ID: <69447b54-f0ea-de74-ea9b-5184c44bddc8@redhat.com> Subject: Re: [PATCH v3 3/9] block: Let write zeroes fallback work even with small max_transfer References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-4-git-send-email-eblake@redhat.com> <20161122131653.GD5615@noname.redhat.com> In-Reply-To: <20161122131653.GD5615@noname.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/22/2016 07:16 AM, Kevin Wolf wrote: > Am 17.11.2016 um 21:13 hat Eric Blake geschrieben: >> Commit 443668ca rewrote the write_zeroes logic to guarantee that >> an unaligned request never crosses a cluster boundary. But >> in the rewrite, the new code assumed that at most one iteration >> would be needed to get to an alignment boundary. >> >> @@ -1257,8 +1262,6 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes= (BlockDriverState *bs, >> >> if (ret =3D=3D -ENOTSUP) { >> /* Fall back to bounce buffer if write zeroes is unsuppor= ted */ >> - int max_transfer =3D MIN_NON_ZERO(bs->bl.max_transfer, >> - MAX_WRITE_ZEROES_BOUNCE_B= UFFER); >> BdrvRequestFlags write_flags =3D flags & ~BDRV_REQ_ZERO_W= RITE; >=20 > Why do we even still bother with max_transfer in this function when we > could just call bdrv_aligned_pwritev() and use its fragmentation code? Hmm. bdrv_aligned_pwritev() asserts that its arguments are already aligned, but for the head and tail, they might not be. I agree that for the bulk of the body, it may help, but it would take more thought on refactoring if we want to have fragmentation at only one spot. >=20 > Of course, when bdrv_co_do_pwrite_zeroes() was written, your > fragmentation code didn't exist yet, but today I think it would make > more sense to use a single centralised version of it instead of > reimplementing it here. >=20 > This doesn't make your fix less correct, but if we did things this way,= > the fix wouldn't even be needed because a single iteration (in this > loop) would indeed always be enough. Can I request to defer such refactoring to 2.9, while getting this patch as-is into 2.8? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ixtdoHPFLaHFClxj3ngBcSF9ug19eQ7wR 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/ iQEcBAEBCAAGBQJYNEaDAAoJEKeha0olJ0Nqx7UH/1H5mNgNnwN9LLkWwmCNNAUy 7orrtOaruZj6E8HLP+an+xuInjWOnElUcU59PqDhYE4bmRIOOKpn4C47g0V4daAV ikblRVEUS3dojrV+XDyZEEFVGts7T/SyBJbFS28BECVa3Fq1iLnKocNlSURVEWzN hPU6ula5QrIivXQnOB8KMupKAUoEr/cFmckt5T4Txk+IWkCuFabyrcT8bSIB29YU v5k47v8B7nRP1UtoQ/LBSEJkTUUCQT8K775uIt49VC2qEaoEjEfMIrS00E8TZbrE ERLS/ogrGEW83WvwLHc/i3UYEDiAR08C9aftTcDGzkTLT9QYRBAy97JOhixOh/E= =q1xO -----END PGP SIGNATURE----- --ixtdoHPFLaHFClxj3ngBcSF9ug19eQ7wR--