From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4sQU-0005tm-9X for qemu-devel@nongnu.org; Mon, 23 May 2016 12:09:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4sQS-0003oJ-3r for qemu-devel@nongnu.org; Mon, 23 May 2016 12:09:53 -0400 References: <1464008051-6429-1-git-send-email-pbonzini@redhat.com> <1464008051-6429-5-git-send-email-pbonzini@redhat.com> From: Eric Blake Message-ID: <57432B45.3080606@redhat.com> Date: Mon, 23 May 2016 10:09:41 -0600 MIME-Version: 1.0 In-Reply-To: <1464008051-6429-5-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Q3nvI8crxDnJIRXh5C1KHhasgl9qsfEPf" Subject: Re: [Qemu-devel] [PATCH 4/7] 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: qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Q3nvI8crxDnJIRXh5C1KHhasgl9qsfEPf Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/23/2016 06:54 AM, Paolo Bonzini wrote: > These are replacements for blk_aio_preadv and blk_aio_pwritev that allo= w > 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 | 63 +++++++++++++++++++++++++++++++++++++++++++--= -------- > 1 file changed, 52 insertions(+), 11 deletions(-) >=20 > =20 > +static > +BlockAIOCB *scsi_dma_readv(int64_t offset, QEMUIOVector *iov, > + BlockCompletionFunc *cb, void *cb_opaque, > + void *opaque) > +{ > + SCSIDiskReq *r =3D opaque; > + SCSIDiskState *s =3D DO_UPCAST(SCSIDiskState, qdev, r->req.dev); DO_UPCAST() is poorly named, and I've been trying to reduce its use in the tree; can we use container_of() instead? > + return blk_aio_preadv(s->qdev.conf.blk, offset, iov, 0, cb, cb_opa= que); > +} > + > +static > +BlockAIOCB *scsi_dma_writev(int64_t offset, QEMUIOVector *iov, > + BlockCompletionFunc *cb, void *cb_opaque, > + void *opaque) > +{ > + SCSIDiskReq *r =3D opaque; > + SCSIDiskState *s =3D DO_UPCAST(SCSIDiskState, qdev, r->req.dev); > + return blk_aio_pwritev(s->qdev.conf.blk, offset, iov, 0, cb, cb_op= aque); Are we ever going to want to pass flags (such as BDRV_REQ_FUA) on to blk_aio_pwritev(), which would imply a flags argument to scsi_dma_writev()? But it doesn't have to happen now, so it's not holding up my review. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Q3nvI8crxDnJIRXh5C1KHhasgl9qsfEPf 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/ iQEcBAEBCAAGBQJXQytGAAoJEKeha0olJ0Nqf8EH/j8MeHVWOmbTi5wZt2wSM5Dw Ma5zJ/saFccwTs4ifdukmiPD0elXdYfFd5f1FddqUFe0INk/8yr+fVDlGrcZ6nz9 MF7goCjF+t6gQgkNzz4byQDFbNcZKmzexi+QeHsfF6DJqK8LQUp+T/2v2KPIHoed 32uEOW3lYGj1CQPp9VUnhqBPkhwKGJMwjGKpvuvhl4zPJU23l3FzL/twUUVydTcS h3EBu4lz352RlrCWlHxaEMaytFCS6RNc9jzIKJwoWJggkYkcr/gs9UgQgo0/lPvB r7/eBAvEIw7gBqTCE3cDpurYgofPsfsPJ611Wn3d30KsG1algJ8xub8W8b9IhfM= =0VMO -----END PGP SIGNATURE----- --Q3nvI8crxDnJIRXh5C1KHhasgl9qsfEPf--