From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Cc: pbonzini@redhat.com, mreitz@redhat.com, stefanha@redhat.com,
famz@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 4/6] raw-posix: Switch to bdrv_co_* interfaces
Date: Wed, 8 Jun 2016 09:13:35 -0600 [thread overview]
Message-ID: <5758361F.2000005@redhat.com> (raw)
In-Reply-To: <1465395011-26088-5-git-send-email-kwolf@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3123 bytes --]
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
>
> 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.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/linux-aio.c | 85 +++++++++++++++++++++++++++++++++++++++++--------------
> block/raw-aio.h | 2 ++
> block/raw-posix.c | 59 ++++++++++++++++++--------------------
> 3 files changed, 92 insertions(+), 54 deletions(-)
>
> +
> +int laio_submit_co(BlockDriverState *bs, LinuxAioState *s, int fd,
> + int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, int type)
> +{
> + off_t offset = sector_num * 512;
BDRV_SECTOR_SIZE instead of a magic number?
> + int ret;
> +
> + struct qemu_laiocb laiocb = {
> + .co = qemu_coroutine_self(),
> + .nbytes = 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 = sector_num * 512;
> + int ret;
> +
> + laiocb = qemu_aio_get(&laio_aiocb_info, bs, cb, opaque);
> + laiocb->nbytes = nb_sectors * 512;
and again
> @@ -1345,14 +1344,26 @@ static BlockAIOCB *raw_aio_submit(BlockDriverState *bs,
> type |= 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, qiov,
> + nb_sectors, type);
Indentation is now off
> @@ -1957,8 +1952,8 @@ BlockDriver bdrv_file = {
> .bdrv_co_get_block_status = raw_co_get_block_status,
> .bdrv_co_pwrite_zeroes = raw_co_pwrite_zeroes,
>
> - .bdrv_aio_readv = raw_aio_readv,
> - .bdrv_aio_writev = raw_aio_writev,
> + .bdrv_co_readv = raw_co_readv,
> + .bdrv_co_writev = raw_co_writev,
> .bdrv_aio_flush = raw_aio_flush,
Why bother with indented alignment of '=' 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 <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-06-08 15:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-08 14:10 [Qemu-devel] [PATCH 0/6] block: Enable byte granularity I/O Kevin Wolf
2016-06-08 14:10 ` [Qemu-devel] [PATCH 1/6] block: Byte-based bdrv_co_do_copy_on_readv() Kevin Wolf
2016-06-08 14:25 ` Eric Blake
2016-06-14 12:09 ` Stefan Hajnoczi
2016-06-08 14:10 ` [Qemu-devel] [PATCH 2/6] block: Prepare bdrv_aligned_preadv() for byte-aligned requests Kevin Wolf
2016-06-08 14:33 ` Eric Blake
2016-06-14 12:09 ` Stefan Hajnoczi
2016-06-08 14:10 ` [Qemu-devel] [PATCH 3/6] block: Prepare bdrv_aligned_pwritev() " Kevin Wolf
2016-06-08 14:46 ` Eric Blake
2016-06-14 12:09 ` Stefan Hajnoczi
2016-06-08 14:10 ` [Qemu-devel] [PATCH 4/6] raw-posix: Switch to bdrv_co_* interfaces Kevin Wolf
2016-06-08 15:13 ` Eric Blake [this message]
2016-06-14 12:04 ` Stefan Hajnoczi
2016-06-08 14:10 ` [Qemu-devel] [PATCH 5/6] raw-posix: Implement .bdrv_co_preadv/pwritev Kevin Wolf
2016-06-08 15:38 ` Eric Blake
2016-06-14 12:09 ` Stefan Hajnoczi
2016-06-08 14:10 ` [Qemu-devel] [PATCH 6/6] block: Don't enforce 512 byte minimum alignment Kevin Wolf
2016-06-08 16:06 ` Eric Blake
2016-06-14 12:09 ` Stefan Hajnoczi
2016-06-14 13:04 ` Kevin Wolf
2016-06-13 13:27 ` [Qemu-devel] [PATCH 0/6] block: Enable byte granularity I/O Stefan Hajnoczi
2016-06-13 13:43 ` Kevin Wolf
2016-06-14 8:57 ` Stefan Hajnoczi
2016-06-14 12:10 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5758361F.2000005@redhat.com \
--to=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).