From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avPt2-0004hn-1D for qemu-devel@nongnu.org; Wed, 27 Apr 2016 09:52:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avPt0-0001z6-WC for qemu-devel@nongnu.org; Wed, 27 Apr 2016 09:52:15 -0400 References: <1461750767-23273-1-git-send-email-kwolf@redhat.com> <1461750767-23273-2-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <5720C404.8060807@redhat.com> Date: Wed, 27 Apr 2016 07:52:04 -0600 MIME-Version: 1.0 In-Reply-To: <1461750767-23273-2-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ht4MNNKhkesK66S7dMTrmrJ0r9rJhbk0C" Subject: Re: [Qemu-devel] [PATCH 01/17] block: Introduce bdrv_driver_preadv() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: famz@redhat.com, sw@weilnetz.de, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Ht4MNNKhkesK66S7dMTrmrJ0r9rJhbk0C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/27/2016 03:52 AM, Kevin Wolf wrote: > This is a function that simply calls into the block driver for doing a > read, providing the byte granularity interface we want to eventually > have everywhere, and using whatever interface that driver supports. >=20 > For now, this is just a wrapper for calling bs->drv->bdrv_co_readv(). >=20 > Signed-off-by: Kevin Wolf > --- > block/io.c | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) >=20 > diff --git a/block/io.c b/block/io.c > index a7dbf85..586a46a 100644 > --- a/block/io.c > +++ b/block/io.c > @@ -800,6 +800,21 @@ int bdrv_pwrite_sync(BlockDriverState *bs, int64_t= offset, > return 0; > } > =20 > +static int coroutine_fn bdrv_driver_preadv(BlockDriverState *bs, > + uint64_t offset, uint64_t b= ytes, > + QEMUIOVector *qiov, int fla= gs) > +{ > + BlockDriver *drv =3D bs->drv; > + int64_t sector_num =3D offset >> BDRV_SECTOR_BITS; > + unsigned int nb_sectors =3D bytes >> BDRV_SECTOR_BITS; > + > + assert((offset & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); > + assert((bytes & (BDRV_SECTOR_SIZE - 1)) =3D=3D 0); > + assert((bytes >> BDRV_SECTOR_BITS) <=3D BDRV_REQUEST_MAX_SECTORS);= So for now it is still enforcing 512-byte alignment, but gives us the opportunity to relax things later. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Ht4MNNKhkesK66S7dMTrmrJ0r9rJhbk0C 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/ iQEcBAEBCAAGBQJXIMQEAAoJEKeha0olJ0NqezMH+wfktVoO1sRvjvZI6Elgv2we y6zzKQ7g8cl5eJp6ksK/Wd1L00o8+5iuFL1mvjkMa56t481x0eVz8EtyWinEz/+i EmCaNxHOf83pHUWBcdBvzeh0gsSKlceHwt5Vkc+WANfMZG/NXU+0VWb/vJmbSwsk Km4YHDy1lP2W5Wtf0hAkn19STV+XBljSF43sGyDAcanHEm3UI0r48O4oRT0t1YLd qnoU1mph+v+DYelvu9lkdecNmpY+Eyjsqr24aeVisEj9j/cYc+aAYxscg4uDsJaR wDbnXAqmoidDfQ0BdYMmNk1Fcrln/ociszQCSP78dwfV+BuDVKCdahW2TyEBvSo= =ihUF -----END PGP SIGNATURE----- --Ht4MNNKhkesK66S7dMTrmrJ0r9rJhbk0C--