cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-virtio-blk-Refactor-the-code-that-processes-queued-r.patch

ddf19c
From 73d83d8880e85eedc22c9651b67d1eacd5de5ff4 Mon Sep 17 00:00:00 2001
ddf19c
From: Sergio Lopez Pascual <slp@redhat.com>
ddf19c
Date: Wed, 24 Jun 2020 13:24:52 -0400
ddf19c
Subject: [PATCH 10/12] virtio-blk: Refactor the code that processes queued
ddf19c
 requests
ddf19c
ddf19c
RH-Author: Sergio Lopez Pascual <slp@redhat.com>
ddf19c
Message-id: <20200624132453.111276-2-slp@redhat.com>
ddf19c
Patchwork-id: 97797
ddf19c
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/2] virtio-blk: Refactor the code that processes queued requests
ddf19c
Bugzilla:
ddf19c
RH-Acked-by: John Snow <jsnow@redhat.com>
ddf19c
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
ddf19c
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
ddf19c
Move the code that processes queued requests from
ddf19c
virtio_blk_dma_restart_bh() to its own, non-static, function. This
ddf19c
will allow us to call it from the virtio_blk_data_plane_start() in a
ddf19c
future patch.
ddf19c
ddf19c
Signed-off-by: Sergio Lopez <slp@redhat.com>
ddf19c
Message-Id: <20200603093240.40489-2-slp@redhat.com>
ddf19c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ddf19c
(cherry picked from commit 7aa1c247b466870b0704d3ccdc3755e5e7394dca)
ddf19c
Signed-off-by: Sergio Lopez <slp@redhat.com>
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 hw/block/virtio-blk.c          | 16 +++++++++++-----
ddf19c
 include/hw/virtio/virtio-blk.h |  1 +
ddf19c
 2 files changed, 12 insertions(+), 5 deletions(-)
ddf19c
ddf19c
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
ddf19c
index c4e55fb3de..6ff29a05d6 100644
ddf19c
--- a/hw/block/virtio-blk.c
ddf19c
+++ b/hw/block/virtio-blk.c
ddf19c
@@ -819,15 +819,11 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
ddf19c
     virtio_blk_handle_output_do(s, vq);
ddf19c
 }
ddf19c
 
ddf19c
-static void virtio_blk_dma_restart_bh(void *opaque)
ddf19c
+void virtio_blk_process_queued_requests(VirtIOBlock *s)
ddf19c
 {
ddf19c
-    VirtIOBlock *s = opaque;
ddf19c
     VirtIOBlockReq *req = s->rq;
ddf19c
     MultiReqBuffer mrb = {};
ddf19c
 
ddf19c
-    qemu_bh_delete(s->bh);
ddf19c
-    s->bh = NULL;
ddf19c
-
ddf19c
     s->rq = NULL;
ddf19c
 
ddf19c
     aio_context_acquire(blk_get_aio_context(s->conf.conf.blk));
ddf19c
@@ -855,6 +851,16 @@ static void virtio_blk_dma_restart_bh(void *opaque)
ddf19c
     aio_context_release(blk_get_aio_context(s->conf.conf.blk));
ddf19c
 }
ddf19c
 
ddf19c
+static void virtio_blk_dma_restart_bh(void *opaque)
ddf19c
+{
ddf19c
+    VirtIOBlock *s = opaque;
ddf19c
+
ddf19c
+    qemu_bh_delete(s->bh);
ddf19c
+    s->bh = NULL;
ddf19c
+
ddf19c
+    virtio_blk_process_queued_requests(s);
ddf19c
+}
ddf19c
+
ddf19c
 static void virtio_blk_dma_restart_cb(void *opaque, int running,
ddf19c
                                       RunState state)
ddf19c
 {
ddf19c
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
ddf19c
index cddcfbebe9..cf8eea2f58 100644
ddf19c
--- a/include/hw/virtio/virtio-blk.h
ddf19c
+++ b/include/hw/virtio/virtio-blk.h
ddf19c
@@ -84,5 +84,6 @@ typedef struct MultiReqBuffer {
ddf19c
 } MultiReqBuffer;
ddf19c
 
ddf19c
 bool virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq);
ddf19c
+void virtio_blk_process_queued_requests(VirtIOBlock *s);
ddf19c
 
ddf19c
 #endif
ddf19c
-- 
ddf19c
2.27.0
ddf19c