Received: from eggs.gnu.org ([2001:4830:134:3::10]:57985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7sH1-0000Hf-0c for qemu-devel@nongnu.org; Fri, 18 Nov 2016 18:08:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7sGz-00042h-Tr for qemu-devel@nongnu.org; Fri, 18 Nov 2016 18:08:46 -0500 References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-8-git-send-email-eblake@redhat.com> <72cc9fae-16de-bded-0280-46f58bcefc4f@redhat.com> From: Eric Blake Message-ID: <1177ed59-90d3-e020-c5a7-e42173ad9d0c@redhat.com> Date: Fri, 18 Nov 2016 17:08:37 -0600 MIME-Version: 1.0 In-Reply-To: <72cc9fae-16de-bded-0280-46f58bcefc4f@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="JkcKQ2Btnv9HeB2FprmUqA2NMi6h5iqmI" Subject: Re: [Qemu-devel] [PATCH v2 7/9] blkdebug: Add pass-through write_zero and discard support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --JkcKQ2Btnv9HeB2FprmUqA2NMi6h5iqmI From: Eric Blake To: Max Reitz , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, kwolf@redhat.com, pbonzini@redhat.com Message-ID: <1177ed59-90d3-e020-c5a7-e42173ad9d0c@redhat.com> Subject: Re: [PATCH v2 7/9] blkdebug: Add pass-through write_zero and discard support References: <1479413642-22463-1-git-send-email-eblake@redhat.com> <1479413642-22463-8-git-send-email-eblake@redhat.com> <72cc9fae-16de-bded-0280-46f58bcefc4f@redhat.com> In-Reply-To: <72cc9fae-16de-bded-0280-46f58bcefc4f@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/17/2016 04:47 PM, Max Reitz wrote: > On 17.11.2016 21:14, Eric Blake wrote: >> In order to test the effects of artificial geometry constraints >> on operations like write zero or discard, we first need blkdebug >> to manage these actions. Ideally, it would be nice to let these >> operations also react to injected errors like read/write/flush, >> but it is not trivial to turn bdrv_aio error injection (where >> we return BlockAIOCB*) into bdrv_co (where we return int), not >> to mention the fact that I don't want to conflict with Kevin's >> concurrent work on refactoring away from bdrv_aio. So for now, >> the operations merely have a TODO comment for adding error >> injection. >> >> However, one thing we CAN test is the contract promised by the >> block layer; namely, if a device has specified limits on >> alignment or maximum size, then those limits must be obeyed (for >> now, the blkdebug driver merely inherits limits from whatever it >> is wrapping, but the next patch will further enhance it to allow >> specific limit overrides). >> >> Tested by setting up an NBD server with export 'foo', then invoking: >> $ ./qemu-io >> qemu-io> open -o driver=3Dblkdebug blkdebug::nbd://localhost:10809/foo= >> qemu-io> d 0 15M >> qemu-io> w -z 0 15M >> >> Pre-patch, the server never sees the discard (it was silently >> eaten by the block layer); post-patch it is passed across the >> wire. Likewise, pre-patch the write is always passed with >> NBD_WRITE (with 15M of zeroes on the wire), while post-patch >> it can utilize NBD_WRITE_ZEROES (for less traffic). >> >> Signed-off-by: Eric Blake >> --- >> block/blkdebug.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++= +++++++++ >> 1 file changed, 61 insertions(+) >> >> diff --git a/block/blkdebug.c b/block/blkdebug.c >> index 0a47977..d45826d 100644 >> --- a/block/blkdebug.c >> +++ b/block/blkdebug.c >=20 > [...] >=20 >> @@ -522,6 +528,59 @@ static BlockAIOCB *blkdebug_aio_flush(BlockDriver= State *bs, >> } >> >> >> +static int coroutine_fn blkdebug_co_pwrite_zeroes(BlockDriverState *b= s, >> + int64_t offset, int= count, >> + BdrvRequestFlags fl= ags) >> +{ >> + uint32_t align =3D MAX(bs->bl.request_alignment, >> + bs->bl.pwrite_zeroes_alignment); >> + >> + /* Regardless of whether the lower layer has a finer granularity,= >> + * we want to treat any unaligned request as unsupported, and >=20 > Why? Hmm, at the moment, I'm having a hard time coming up with a strong reason why I did that. I'll retest without it, and see if it still picks up the regression fixed by 3/5; if so I'll drop it as part of the respin (since I still have the iotest to fix); if not, I'll have a good reason why and include it in the commit message. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --JkcKQ2Btnv9HeB2FprmUqA2NMi6h5iqmI 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/ iQEcBAEBCAAGBQJYL4n1AAoJEKeha0olJ0Nqd0QH/iGTFX0Ou921FfHk27ylcFNd iQa3HreHQqzCnHFeyvzMGG6FJKio1eZZ9PVkZ1aW7fXOiYpmMIyZxN3Qba1vzh1f 3myoXpv+NP8+7XRL0UiXtYi1gz2b5W6Eq27g2dG8sJP8VTeyKxf8vIdYoqYQfh2g pxS/ztImhvphvrveT3BVGPAyfseAMDLvjgBvDHJ1UKxi0wl5G8t7EShFf5nngX8t /DCjpwZH0NGGQXHQC5m98gHKbkmFw6La+2jWzHLrq3Y0BICTHB9DNJVlEGZomUIC bb8eU4xaLP2997qi53GkEcxQn6oHBYkTfM1XI0k7E8Q0loRUvfRVwm6o9JEsxQI= =OEeU -----END PGP SIGNATURE----- --JkcKQ2Btnv9HeB2FprmUqA2NMi6h5iqmI--