aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi/virtio-scsi.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-09-23 15:49:28 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-09-30 11:11:20 +0200
commit1880ad4f4e3b49f15c55e816d66b9690b3ede00c (patch)
treef02488a1e153e469f00ac5c4527c0f6ba005d3cb /hw/scsi/virtio-scsi.c
parent359eea71d98e7f2cf9efb5e65bb59a240bedb131 (diff)
virtio-scsi: Batched prepare for cmd reqs
Queue the popped requests while calling virtio_scsi_handle_cmd_req_prepare(), then submit them after all prepared. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/scsi/virtio-scsi.c')
-rw-r--r--hw/scsi/virtio-scsi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 6cf070f70e..395178e949 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -502,7 +502,8 @@ static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq)
{
/* use non-QOM casts in the data path */
VirtIOSCSI *s = (VirtIOSCSI *)vdev;
- VirtIOSCSIReq *req;
+ VirtIOSCSIReq *req, *next;
+ QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs);
if (s->ctx && !s->dataplane_disabled) {
virtio_scsi_dataplane_start(s);
@@ -510,9 +511,13 @@ static void virtio_scsi_handle_cmd(VirtIODevice *vdev, VirtQueue *vq)
}
while ((req = virtio_scsi_pop_req(s, vq))) {
if (virtio_scsi_handle_cmd_req_prepare(s, req)) {
- virtio_scsi_handle_cmd_req_submit(s, req);
+ QTAILQ_INSERT_TAIL(&reqs, req, next);
}
}
+
+ QTAILQ_FOREACH_SAFE(req, &reqs, next, next) {
+ virtio_scsi_handle_cmd_req_submit(s, req);
+ }
}
static void virtio_scsi_get_config(VirtIODevice *vdev,