From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Pbg-0006jU-54 for qemu-devel@nongnu.org; Thu, 19 May 2016 11:11:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Pbb-00058B-3k for qemu-devel@nongnu.org; Thu, 19 May 2016 11:11:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Pba-000587-RE for qemu-devel@nongnu.org; Thu, 19 May 2016 11:11:19 -0400 References: <1462966873-30473-1-git-send-email-pbonzini@redhat.com> <1462966873-30473-4-git-send-email-pbonzini@redhat.com> From: Eric Blake Message-ID: <573DD795.4090201@redhat.com> Date: Thu, 19 May 2016 09:11:17 -0600 MIME-Version: 1.0 In-Reply-To: <1462966873-30473-4-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rk00lQF0ihmPSchF7nXsaBL2sKRIWuPm7" Subject: Re: [Qemu-devel] [PATCH 3/4] scsi-disk: introduce dma_readv and dma_writev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: famz@redhat.com, hare@suse.de, vrozenfe@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --rk00lQF0ihmPSchF7nXsaBL2sKRIWuPm7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/11/2016 05:41 AM, Paolo Bonzini wrote: > These are replacements for blk_aio_readv and blk_aio_writev that allow > customization of the data path. They reuse the DMA helpers' DMAIOFunc > callback type, so that the same function can be used in either the > QEMUSGList or the bounce-buffered case. >=20 > This customization will be needed in the next patch to do zero-copy > SG_IO on scsi-block. >=20 > Signed-off-by: Paolo Bonzini > --- > hw/scsi/scsi-disk.c | 64 +++++++++++++++++++++++++++++++++++++++++++++= +------- > 1 file changed, 56 insertions(+), 8 deletions(-) >=20 > @@ -339,14 +354,16 @@ static void scsi_do_read(SCSIDiskReq *r, int ret)= > if (r->req.sg) { > dma_acct_start(s->qdev.conf.blk, &r->acct, r->req.sg, BLOCK_AC= CT_READ); > r->req.resid -=3D r->req.sg->size; > - r->req.aiocb =3D dma_blk_read(s->qdev.conf.blk, r->req.sg, r->= sector, > - scsi_dma_complete, r); > + r->req.aiocb =3D dma_blk_io(blk_get_aio_context(s->qdev.conf.b= lk), > + r->req.sg, r->sector, > + sdc->dma_readv, r, scsi_dma_complete= , r, > + DMA_DIRECTION_FROM_DEVICE); Is it worth considering byte-based rather than sector-based interfaces, as part of this series? > +static > +BlockAIOCB *scsi_dma_readv(int64_t sector_num, > + QEMUIOVector *iov, int nb_sectors, > + BlockCompletionFunc *cb, void *cb_opaque, > + void *opaque) > +{ > + SCSIDiskReq *r =3D opaque; > + SCSIDiskState *s =3D DO_UPCAST(SCSIDiskState, qdev, r->req.dev); > + return blk_aio_readv(s->qdev.conf.blk, sector_num, iov, nb_sectors= , > + cb, cb_opaque); > +} Especially since commit 7b1deac killed blk_aio_readv() in favor of byte-based blk_aio_preadv(). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rk00lQF0ihmPSchF7nXsaBL2sKRIWuPm7 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/ iQEcBAEBCAAGBQJXPdeVAAoJEKeha0olJ0Nq748IAIJD8LikUCFBGczQ4aELIZBF +Q28B79XETvJocuFr+zBKSOT3hQ9B79ldBiedjjLbw43qFZ35sXvraRlkpnnN1sf 1kUWDVq2K3gxdTLsTitQ9VbCnTvDAfFKAK/S+XBBFQxm6uZmL1Argg4uVi40OM6I s2LO0kmBcP5rWwpATqqGQWUCsYpBqsi8Wvh33rLCu+4cOhwVxWdsSiWW7FIiPOZN j5mKTvA+IDkoZplgluK7pObW0rcND7dWaEwFMmf34l+2nyG152niLXejsMvtPs+k /2eyUky7izowJeA5steylhT+mbUO3sAz5pqJ77jHoTKGBZ3XwbfuSReX31cLmno= =i6ta -----END PGP SIGNATURE----- --rk00lQF0ihmPSchF7nXsaBL2sKRIWuPm7--