From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnNAI-0001hc-Ld for qemu-devel@nongnu.org; Sun, 09 Nov 2014 02:44:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XnNAC-00016g-JP for qemu-devel@nongnu.org; Sun, 09 Nov 2014 02:44:02 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:48526) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XnNAC-00016c-D2 for qemu-devel@nongnu.org; Sun, 09 Nov 2014 02:43:56 -0500 Received: by mail-pd0-f175.google.com with SMTP id y13so5859082pdi.6 for ; Sat, 08 Nov 2014 23:43:56 -0800 (PST) From: Ming Lei Date: Sun, 9 Nov 2014 15:42:58 +0800 Message-Id: <1415518978-2837-14-git-send-email-ming.lei@canonical.com> In-Reply-To: <1415518978-2837-1-git-send-email-ming.lei@canonical.com> References: <1415518978-2837-1-git-send-email-ming.lei@canonical.com> Subject: [Qemu-devel] [PATCH 13/13] virtio-scsi-dataplane: support AioContext wide IO submission as batch List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Peter Maydell , Paolo Bonzini , Stefan Hajnoczi , Kevin Wolf Cc: Ming Lei , Fam Zheng Replace previous usage with AioContext Wide approach. Signed-off-by: Ming Lei --- 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