Received: from eggs.gnu.org ([2001:4830:134:3::10]:58888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIHYq-0006R8-4x for qemu-devel@nongnu.org; Wed, 29 Jun 2016 11:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIHYk-0001L7-Hx for qemu-devel@nongnu.org; Wed, 29 Jun 2016 11:37:55 -0400 References: <0caba858-787c-ccdf-69df-f8dc92528c1f@redhat.com> <1467202266-15088-1-git-send-email-kwolf@redhat.com> <02972b11-ccb3-5c2a-844b-611061506338@redhat.com> <20160629153358.GC4831@noname.redhat.com> From: Max Reitz Message-ID: Date: Wed, 29 Jun 2016 17:37:36 +0200 MIME-Version: 1.0 In-Reply-To: <20160629153358.GC4831@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="e2DictO4dShAEq6kePvusgelbJKHQ4lqT" 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: Kevin Wolf Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --e2DictO4dShAEq6kePvusgelbJKHQ4lqT From: Max Reitz To: Kevin Wolf Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org Message-ID: Subject: Re: [PATCH v2 12/17] block: Convert bdrv_write() to BdrvChild References: <0caba858-787c-ccdf-69df-f8dc92528c1f@redhat.com> <1467202266-15088-1-git-send-email-kwolf@redhat.com> <02972b11-ccb3-5c2a-844b-611061506338@redhat.com> <20160629153358.GC4831@noname.redhat.com> In-Reply-To: <20160629153358.GC4831@noname.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 29.06.2016 17:33, Kevin Wolf wrote: > 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 >>> --- >>> >>> This patch contains non-trivial fixes, so I think it's worth sending = out a v2 >>> for it even though I already applied the series. I added a coroutine = entry >>> wrapper qcow(2)_write that can be used from .bdrv_write_compressed. T= hese >>> wrappers will soon disappear again when .bdrv_write_compressed is cha= nged into >>> .bdrv_co_pwritev_compressed (Pavel Butsykin's backup compression seri= es). >>> >>> 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(-) >> >> Reviewed-by: Max Reitz >> >> [...] >> >>> 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; >> >> 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". >=20 > Hm, just copied from vmdk... Anyway, you right that we don't really nee= d > 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. Oh, right, I missed that. That is actually very clever, I should remember that. Max --e2DictO4dShAEq6kePvusgelbJKHQ4lqT 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 iQEvBAEBCAAZBQJXc+tAEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrV/8 B/9B9pP2ek3zRFP08Z5eKA8zvV2CgVgXoLmgZQwsnexcN8VJsUBnECagccigOzkf XakzJHSfPy0z1Xm1KUL+RMIFF0vsN6/4eAg6nFDiKAIZydLQUwaHSeaEKqFQKYwS Gc1EovAxfOttMV1TTaPEMIlqkYyGo9+kMn9SujKH3K4PImi8xLoydyLx/oor2vqH 7w9egMVGV/pOLCbkdszz41u6KcfkZBNYF2Y4Me/8QCAjJrX9SmUf494rcLz3ROrt Bh31W4Z7zvKnt2Ez5p2mWYq5/Hri29ahhjJT91y+pZDAw61JZzFnrxkUOIFZwiUk JVO7vSFgzwasJmbWnVKAiWLj =7E/V -----END PGP SIGNATURE----- --e2DictO4dShAEq6kePvusgelbJKHQ4lqT--