From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAfAz-0007e7-Ai for qemu-devel@nongnu.org; Wed, 08 Jun 2016 11:13:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAfAs-0008Ug-K3 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 11:13:43 -0400 References: <1465395011-26088-1-git-send-email-kwolf@redhat.com> <1465395011-26088-5-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <5758361F.2000005@redhat.com> Date: Wed, 8 Jun 2016 09:13:35 -0600 MIME-Version: 1.0 In-Reply-To: <1465395011-26088-5-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="r3mW70MxbjPx5q64rCBoh97hh2v7jmLXB" Subject: Re: [Qemu-devel] [PATCH 4/6] raw-posix: Switch to bdrv_co_* interfaces List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: pbonzini@redhat.com, mreitz@redhat.com, stefanha@redhat.com, famz@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --r3mW70MxbjPx5q64rCBoh97hh2v7jmLXB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/08/2016 08:10 AM, Kevin Wolf wrote: > In order to use the modern byte-based .bdrv_co_preadv/pwritev() > interface, this patch switches raw-posix to coroutine-based interfaces > as a first step. In terms of semantics and performance, it doesn't make= > a difference with the existing code whether we go from a coroutine to a= > callback-based interface already in block/io.c or only in linux-aio.c >=20 > As there have been concerns in the past that this change may be a step > in the wrong direction with respect to a possible AIO fast path, the > old callback-based interface for linux-aio is left around and can be > reactivated when a fast path (e.g. directly from virtio-blk dataplane, > bypassing the whole block layer) is implemented. >=20 > Signed-off-by: Kevin Wolf > --- > block/linux-aio.c | 85 +++++++++++++++++++++++++++++++++++++++++------= -------- > block/raw-aio.h | 2 ++ > block/raw-posix.c | 59 ++++++++++++++++++-------------------- > 3 files changed, 92 insertions(+), 54 deletions(-) >=20 > + > +int laio_submit_co(BlockDriverState *bs, LinuxAioState *s, int fd, > + int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int ty= pe) > +{ > + off_t offset =3D sector_num * 512; BDRV_SECTOR_SIZE instead of a magic number? > + int ret; > + > + struct qemu_laiocb laiocb =3D { > + .co =3D qemu_coroutine_self(), > + .nbytes =3D nb_sectors * 512, and again > + > +BlockAIOCB *laio_submit(BlockDriverState *bs, LinuxAioState *s, int fd= , > + int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, > + BlockCompletionFunc *cb, void *opaque, int type) > +{ > + struct qemu_laiocb *laiocb; > + off_t offset =3D sector_num * 512; > + int ret; > + > + laiocb =3D qemu_aio_get(&laio_aiocb_info, bs, cb, opaque); > + laiocb->nbytes =3D nb_sectors * 512; and again > @@ -1345,14 +1344,26 @@ static BlockAIOCB *raw_aio_submit(BlockDriverSt= ate *bs, > type |=3D QEMU_AIO_MISALIGNED; > #ifdef CONFIG_LINUX_AIO > } else if (s->use_aio) { > - return laio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov= , > - nb_sectors, cb, opaque, type); > + return laio_submit_co(bs, s->aio_ctx, s->fd, sector_num, q= iov, > + nb_sectors, type); Indentation is now off > @@ -1957,8 +1952,8 @@ BlockDriver bdrv_file =3D { > .bdrv_co_get_block_status =3D raw_co_get_block_status, > .bdrv_co_pwrite_zeroes =3D raw_co_pwrite_zeroes, > =20 > - .bdrv_aio_readv =3D raw_aio_readv, > - .bdrv_aio_writev =3D raw_aio_writev, > + .bdrv_co_readv =3D raw_co_readv, > + .bdrv_co_writev =3D raw_co_writev, > .bdrv_aio_flush =3D raw_aio_flush, Why bother with indented alignment of '=3D' when none of the neighbors do= ? Findings are minor enough, so up to you whether to fix them or just mark this: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --r3mW70MxbjPx5q64rCBoh97hh2v7jmLXB 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/ iQEcBAEBCAAGBQJXWDYfAAoJEKeha0olJ0Nq2zgIAJLwK74cYmLrPHVfpeS59Ac1 NJsoXuUqjrLkhfV1/dkNVYFm8SVgYoXrdw7Xnel0pDyuAyJ9asUea7QfDpz8Zy2v lzzTHXGVdusxnmkRoO2A3xDudP4YgrnpEHMAq65JRZNNnuvZ5Ntlbci2s5kTyhOy 07dXr7UEGLvMMfLm4cMNZEko5KsNx67SG84qRMd4nMtS7jdu1wc1F1IrO/8ZgFGD eSBnQBq3WoEQTl6PJf/DqnCY7ADJ2F9D6l1xPA47CteRpfylMRcz5+Tz+SIE2auD eki6XAIso9llO27yK5Ny18SbP5vYFXL7jOpPDxg3E4GpmSKsX3bPCLkkAFxMbXE= =PXxI -----END PGP SIGNATURE----- --r3mW70MxbjPx5q64rCBoh97hh2v7jmLXB--