From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIHVB-0003tF-3N for qemu-devel@nongnu.org; Wed, 29 Jun 2016 11:34:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIHV8-0000Qn-Ty for qemu-devel@nongnu.org; Wed, 29 Jun 2016 11:34:08 -0400 Date: Wed, 29 Jun 2016 17:33:58 +0200 From: Kevin Wolf Message-ID: <20160629153358.GC4831@noname.redhat.com> References: <0caba858-787c-ccdf-69df-f8dc92528c1f@redhat.com> <1467202266-15088-1-git-send-email-kwolf@redhat.com> <02972b11-ccb3-5c2a-844b-611061506338@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bn2rw/3z4jIqBvZU" Content-Disposition: inline In-Reply-To: <02972b11-ccb3-5c2a-844b-611061506338@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 12/17] block: Convert bdrv_write() to BdrvChild List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 29.06.2016 um 17:22 hat Max Reitz geschrieben: > On 29.06.2016 14:11, Kevin Wolf wrote: > > Signed-off-by: Kevin Wolf > > Acked-by: Stefan Hajnoczi > > --- > >=20 > > This patch contains non-trivial fixes, so I think it's worth sending ou= t a v2 > > for it even though I already applied the series. I added a coroutine en= try > > wrapper qcow(2)_write that can be used from .bdrv_write_compressed. The= se > > wrappers will soon disappear again when .bdrv_write_compressed is chang= ed into > > .bdrv_co_pwritev_compressed (Pavel Butsykin's backup compression series= ). > >=20 > > block/io.c | 5 +++-- > > block/qcow.c | 45 ++++++++++++++++++++++++++++++++++++++++++= ++- > > block/qcow2-cluster.c | 2 +- > > block/qcow2-refcount.c | 2 +- > > block/qcow2.c | 47 ++++++++++++++++++++++++++++++++++++++++++= ++++- > > block/vdi.c | 4 ++-- > > block/vvfat.c | 5 ++--- > > include/block/block.h | 2 +- > > 8 files changed, 100 insertions(+), 12 deletions(-) >=20 > Reviewed-by: Max Reitz >=20 > [...] >=20 > > diff --git a/block/qcow2.c b/block/qcow2.c > > index 0178931..cd9c27b 100644 > > --- a/block/qcow2.c > > +++ b/block/qcow2.c > > @@ -2533,6 +2533,51 @@ static int qcow2_truncate(BlockDriverState *bs, = int64_t offset) > > return 0; > > } > > =20 > > +typedef struct Qcow2WriteCo { > > + BlockDriverState *bs; > > + int64_t sector_num; > > + const uint8_t *buf; > > + int nb_sectors; > > + int ret; > > +} Qcow2WriteCo; > > + > > +static void qcow2_write_co_entry(void *opaque) > > +{ > > + Qcow2WriteCo *co =3D opaque; > > + QEMUIOVector qiov; > > + uint64_t offset =3D co->sector_num * BDRV_SECTOR_SIZE; > > + uint64_t bytes =3D co->nb_sectors * BDRV_SECTOR_SIZE; >=20 > It doesn't make much sense to make this a uint64_t, and I'm afraid > Coverity will complain about it... It's not wrong, though, but an int > would have been more "honest". Hm, just copied from vmdk... Anyway, you right that we don't really need uint64_t here because of BDRV_REQUEST_MAX_SECTORS, but BDRV_SECTOR_SIZE is unsigned long long, so at least this is a proper 64 bit calculation and Coverity should stay silent. Kevin --Bn2rw/3z4jIqBvZU Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXc+plAAoJEH8JsnLIjy/W++wQAIjTmhGYugoyQqCMeHnTIBC7 Vh+RloY2u4aXPGwhA7hUTWY0QeLktzlf89/vAKXBQxPkWQOzyugulux01Ibf5RqS aM5gmKbgsZ9+HljH9xbNqfbnT8eXpzerr7kFAFo+1VFL8uN9y9mpAAOT2fiFrnHO AMIZqYpUjXa13NnDxvFIVuNCF5tqhi8rcqEoZiycz4AAI2ReP1ZOv1Z+tcpu++7y SI24wZ3HTUyzgeZ12prr6+NJlKuKwCbGkMhdIvwM8BfpHvA+KGufiRH91q7duFaf GBIDqE+uWrJhPkB/sSbJY6y7FJNpSBcUIuRUfVbZm65bZSWPZgWYaHnxEFgHBdI9 60PknYvGsd7RZhrkmI15x59v891fQuX8am5+/E2+9MFBoVpOhXg4bA8+9Qtc4MJ0 DmMYsUw9Q+CiBTVAzd4h24UtZgRo7D6XjTdDE6kREz6SfcS4SWYd/WiNRUvE4mQX fjuewVnvpHH4WcEPKCmPnIwvo2K8D87krDvIzBML1n5RRdRzzDAFa9fc1HMbRQm2 Wy/EYpGuB2xFpjEQCpzRqWt6PHYbsM0NCmpu6VoPBEFU40enVgpJMbTwA+3PibUc FdeV+12Cia3ooroEP1OIEckvLW68avF8fVhwU3VCUHbMqC8MLonpQbHS3bvcdOKo bAxNsSxwiI54RWVIHVJH =mQSc -----END PGP SIGNATURE----- --Bn2rw/3z4jIqBvZU--