qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@canonical.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>
Cc: Ming Lei <ming.lei@canonical.com>, Fam Zheng <famz@redhat.com>
Subject: [Qemu-devel] [PATCH 13/13] virtio-scsi-dataplane: support AioContext wide IO submission as batch
Date: Sun,  9 Nov 2014 15:42:58 +0800	[thread overview]
Message-ID: <1415518978-2837-14-git-send-email-ming.lei@canonical.com> (raw)
In-Reply-To: <1415518978-2837-1-git-send-email-ming.lei@canonical.com>

Replace previous usage with AioContext Wide approach.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
 hw/scsi/virtio-scsi-dataplane.c |    8 ++++++++
 hw/scsi/virtio-scsi.c           |    2 --
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c
index 9651e6f..7fab14d 100644
--- a/hw/scsi/virtio-scsi-dataplane.c
+++ b/hw/scsi/virtio-scsi-dataplane.c
@@ -135,8 +135,12 @@ static void virtio_scsi_iothread_handle_cmd(EventNotifier *notifier)
     VirtIOSCSI *s = (VirtIOSCSI *)vring->parent;
     VirtIOSCSIReq *req, *next;
     QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs);
+    AioContext *ctx = s->ctx;
+    bool plugged;
 
     event_notifier_test_and_clear(notifier);
+
+    plugged = bdrv_aio_io_plug(ctx);
     while ((req = virtio_scsi_pop_req_vring(s, vring))) {
         if (virtio_scsi_handle_cmd_req_prepare(s, req)) {
             QTAILQ_INSERT_TAIL(&reqs, req, next);
@@ -146,6 +150,10 @@ static void virtio_scsi_iothread_handle_cmd(EventNotifier *notifier)
     QTAILQ_FOREACH_SAFE(req, &reqs, next, next) {
         virtio_scsi_handle_cmd_req_submit(s, req);
     }
+
+    if (plugged) {
+        bdrv_aio_io_unplug(ctx);
+    }
 }
 
 /* assumes s->ctx held */
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index fdcacfd..6e34a2c 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -540,7 +540,6 @@ bool virtio_scsi_handle_cmd_req_prepare(VirtIOSCSI *s, VirtIOSCSIReq *req)
         return false;
     }
     scsi_req_ref(req->sreq);
-    blk_io_plug(d->conf.blk);
     return true;
 }
 
@@ -550,7 +549,6 @@ void virtio_scsi_handle_cmd_req_submit(VirtIOSCSI *s, VirtIOSCSIReq *req)
     if (scsi_req_enqueue(sreq)) {
         scsi_req_continue(sreq);
     }
-    blk_io_unplug(sreq->dev->conf.blk);
     scsi_req_unref(sreq);
 }
 
-- 
1.7.9.5

  parent reply	other threads:[~2014-11-09  7:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-09  7:42 [Qemu-devel] [PATCH 00/13] linux-aio/virtio-scsi: support AioContext wide IO submission as batch Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 01/13] block/linux-aio: allocate io queue dynamically Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 02/13] block: linux-aio: rename 'ctx' of qemu_laiocb as 'laio_state' Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 03/13] block/linux-aio: allocate 'struct qemu_laio_state' dynamically Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 04/13] block/linux-aio: do more things in laio_state_alloc() and its pair Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 05/13] block/linux-aio: pass 'BlockDriverState' to laio_attach_aio_context " Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 06/13] AioContext: introduce aio_attach_aio_bs() " Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 07/13] block/linux-aio: support IO submission as batch in AioContext wide Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 08/13] block/linux-aio.c: allocate events dynamically Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 09/13] block/linux-aio.c: introduce laio_alloc_resource() Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 10/13] block/linux-aio.c: prepare for elastical resource's allocation Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 11/13] block/linux-aio: reallocate I/O resources when aio attached Ming Lei
2014-11-09  7:42 ` [Qemu-devel] [PATCH 12/13] block: introduce bdrv_aio_io_plug() and its pair Ming Lei
2014-11-09  7:42 ` Ming Lei [this message]
2014-11-18 13:57 ` [Qemu-devel] [PATCH 00/13] linux-aio/virtio-scsi: support AioContext wide IO submission as batch Paolo Bonzini
2014-11-22 12:33   ` Ming Lei
2014-11-25 10:47     ` Paolo Bonzini

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=1415518978-2837-14-git-send-email-ming.lei@canonical.com \
    --to=ming.lei@canonical.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.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).