From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2LlS-0001t4-Dx for qemu-devel@nongnu.org; Mon, 16 May 2016 12:53:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2LlN-0008EW-UR for qemu-devel@nongnu.org; Mon, 16 May 2016 12:53:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2LlN-0008E4-HJ for qemu-devel@nongnu.org; Mon, 16 May 2016 12:53:01 -0400 References: <1463229957-14253-1-git-send-email-den@openvz.org> <1463229957-14253-2-git-send-email-den@openvz.org> From: Eric Blake Message-ID: <5739FAEB.9080702@redhat.com> Date: Mon, 16 May 2016 10:52:59 -0600 MIME-Version: 1.0 In-Reply-To: <1463229957-14253-2-git-send-email-den@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="er2JAbclIwiCT7sRXae3DG3I1md3upnRa" Subject: Re: [Qemu-devel] [PATCH 01/10] block/io: add bdrv_co_write_compressed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" , qemu-devel@nongnu.org Cc: Pavel Butsykin , Jeff Cody , Markus Armbruster , John Snow , Stefan Hajnoczi , Kevin Wolf This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --er2JAbclIwiCT7sRXae3DG3I1md3upnRa Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/14/2016 06:45 AM, Denis V. Lunev wrote: > From: Pavel Butsykin >=20 > This patch just adds the interface to the bdrv_co_write_compressed, whi= ch > is currently not used but will be useful for safe implementation of the= > bdrv_co_write_compressed callback in format drivers. >=20 > Signed-off-by: Pavel Butsykin > Signed-off-by: Denis V. Lunev > CC: Jeff Cody > CC: Markus Armbruster > CC: Eric Blake > CC: John Snow > CC: Stefan Hajnoczi > CC: Kevin Wolf > --- > +++ b/block/io.c > @@ -1828,8 +1828,8 @@ int bdrv_is_allocated_above(BlockDriverState *top= , > return 0; > } > =20 > -int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, > - const uint8_t *buf, int nb_sectors) > +int bdrv_co_write_compressed(BlockDriverState *bs, int64_t sector_num,= > + int nb_sectors, QEMUIOVector *qiov) As long as we're adding a new public interface, I'd really like us to make it byte-based. int64_t sector_num might be better represented as a byte offset, and int nb_sectors seems redundant with qiov->size. > { > BlockDriver *drv =3D bs->drv; > int ret; > @@ -1837,7 +1837,7 @@ int bdrv_write_compressed(BlockDriverState *bs, i= nt64_t sector_num, > if (!drv) { > return -ENOMEDIUM; > } > - if (!drv->bdrv_write_compressed) { > + if (!drv->bdrv_co_write_compressed) { > return -ENOTSUP; > } > ret =3D bdrv_check_request(bs, sector_num, nb_sectors); > @@ -1846,8 +1846,71 @@ int bdrv_write_compressed(BlockDriverState *bs, = int64_t sector_num, > } > =20 > assert(QLIST_EMPTY(&bs->dirty_bitmaps)); > + assert(qemu_in_coroutine()); > + > + return drv->bdrv_co_write_compressed(bs, sector_num, nb_sectors, q= iov); Of course, if you make the public interface byte-based, then calling into the back end will have to scale back to sectors (after first asserting that we aren't violating the scaling); see how Kevin did it in commit 166fe9605. > +} > + > +typedef struct BdrvWriteCompressedCo { > + BlockDriverState *bs; > + int64_t sector_num; Again, I think a byte offset is smarter than a sector number. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --er2JAbclIwiCT7sRXae3DG3I1md3upnRa 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/ iQEcBAEBCAAGBQJXOfrrAAoJEKeha0olJ0NqsTkH+wQyhrV6y9qZQsxTVAMdMe/b 5AsPaE9KXE0hFkdUogX1E5AfCQDAE2CHTaPdUUdgplOhLxARKiup4ZLM9KKzvi5d h/Vsj225UWCUlJ/CnlWzjDIRMQKNWhcn8yEApudx8FnUvucuigEwbcWH0HszB3Ho 0WBu+25NYOSTgiyS9x96jLtMj6XDHJtda7udhJDc0XTin5l+/J+wqSEn2KjOee2V ZInbJuwahnIw94Hv63PC98BF6WnW9RUAyO7PvpRtuDEZA2vhNFRPw2fm2hkbs9PA TV6fyHa+k64BAxOEWGhGucSeD930Q2zhzFb4WM+8F56V1rVCCTosa/IulRIYJL8= =TxDc -----END PGP SIGNATURE----- --er2JAbclIwiCT7sRXae3DG3I1md3upnRa--