thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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