From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHqeP-0007Hr-CY for qemu-devel@nongnu.org; Tue, 28 Jun 2016 06:53:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHqeJ-0004Ll-Dk for qemu-devel@nongnu.org; Tue, 28 Jun 2016 06:53:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHqeJ-0004LX-5U for qemu-devel@nongnu.org; Tue, 28 Jun 2016 06:53:47 -0400 Date: Tue, 28 Jun 2016 12:53:43 +0200 From: Kevin Wolf Message-ID: <20160628105343.GA6800@noname.redhat.com> References: <1464686130-12265-1-git-send-email-den@openvz.org> <1464686130-12265-2-git-send-email-den@openvz.org> <575EC1DC.5020501@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <575EC1DC.5020501@redhat.com> Subject: Re: [Qemu-devel] [PATCH 01/11] block: switch blk_write_compressed() to byte-based interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: "Denis V. Lunev" , qemu-devel@nongnu.org, Pavel Butsykin , Jeff Cody , Markus Armbruster , John Snow , Stefan Hajnoczi --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 13.06.2016 um 16:23 hat Eric Blake geschrieben: > On 05/31/2016 03:15 AM, Denis V. Lunev wrote: > > From: Pavel Butsykin > >=20 > > This is a preparatory patch, which continues the general trend of the t= ransition > > to the byte-based interfaces. > >=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 > > -int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, > > - const uint8_t *buf, int nb_sectors) > > +int bdrv_pwrite_compressed(BlockDriverState *bs, int64_t offset, > > + const void *buf, int count) > > { > > BlockDriver *drv =3D bs->drv; > > int ret; > > @@ -1791,14 +1791,15 @@ int bdrv_write_compressed(BlockDriverState *bs,= int64_t sector_num, > > if (!drv->bdrv_write_compressed) { > > return -ENOTSUP; > > } > > - ret =3D bdrv_check_request(bs, sector_num, nb_sectors); > > + ret =3D bdrv_check_byte_request(bs, offset, count); > > if (ret < 0) { > > return ret; > > } > > =20 > > assert(QLIST_EMPTY(&bs->dirty_bitmaps)); > > =20 > > - return drv->bdrv_write_compressed(bs, sector_num, buf, nb_sectors); > > + return drv->bdrv_write_compressed(bs, offset >> BDRV_SECTOR_BITS, = buf, > > + count >> BDRV_SECTOR_BITS); >=20 > If you are going to shift right, you need to first assert that offset > and count are aligned (and thus that our call to a sector interface > isn't going to operate on the wrong data). See for example commit 166fe9= 60. Yes, I would like to have these assertions at least. But I'm wondering what the point of converting the interface is when we don't intend to actually support sub-sector requests and the sector alignment is still required at the end of the series. Kevin --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXclc3AAoJEH8JsnLIjy/WeakQAJFArscaDzyxfFFZFmy+B6o5 MYOMsZJX8f+l6W6AfVBjpzdU9sxzECX/9rmCjsTJaqlH8PGJ0QD1jVdt3aWYhpLF MpV1ik4q52eyIlYh84mYE72K3oFjH32WovphIY1jYIeQXBTY/auJX/6IcfMP8m3/ p8TuaUijtSCBPEXDqARmor2E6b9KiIkRZ1UOmUyw3P4Ecoe2i4MvrXn2lq15l+M5 zVlPEJEX+2gxiAwGjkekKU+vSIiP7jpRAZesQyQjQSiZebOi90zuniWiutRhfh6S /21SNqkiAQtubnO+zC/PXasTZUyX3gKownu0bgvM2ZU1X1Oyq7wpTlhqTnASahac uotBSqtfmoAvqt/xGiTWQL572/keNmNMfug6n74T5hSAqoXimJsEsvoUBvwma7VJ g4AN8jtuuEPnlnM6sAqzJ9T4bOtq1vJXs/Ku3OkNq3giOhZS2sbeJmliPhsLmji/ 5yb8opcjREX2pTyR8NCNxyVLj4sVhkpFbU5ARIRF9HCS8+7DSoHSj8QSSxq7rBBa oWvOnuMNASxcCWWU5MBbdHcOd7+7SSoADylnUiTvEG1ZD9opWwxIrAg0YTnbNp5y UD9qGqhWasBHUZlN7yD9AAeiknakiLS72bWgNNQc42sznjeRR8R5+xpcLaklpUT9 /iTBU3BVmY9Sp1R2SZ97 =FQhU -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--