[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/43] virtio-blk: Refactor the code that processes queued request
From: |
Kevin Wolf |
Subject: |
[PULL 03/43] virtio-blk: Refactor the code that processes queued requests |
Date: |
Wed, 17 Jun 2020 16:48:29 +0200 |
From: Sergio Lopez <slp@redhat.com>
Move the code that processes queued requests from
virtio_blk_dma_restart_bh() to its own, non-static, function. This
will allow us to call it from the virtio_blk_data_plane_start() in a
future patch.
Signed-off-by: Sergio Lopez <slp@redhat.com>
Message-Id: <20200603093240.40489-2-slp@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/hw/virtio/virtio-blk.h | 1 +
hw/block/virtio-blk.c | 16 +++++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
index 1e62f869b2..f584ad9b86 100644
--- a/include/hw/virtio/virtio-blk.h
+++ b/include/hw/virtio/virtio-blk.h
@@ -86,5 +86,6 @@ typedef struct MultiReqBuffer {
} MultiReqBuffer;
bool virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq);
+void virtio_blk_process_queued_requests(VirtIOBlock *s);
#endif
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index f5f6fc925e..978574e4da 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -819,15 +819,11 @@ static void virtio_blk_handle_output(VirtIODevice *vdev,
VirtQueue *vq)
virtio_blk_handle_output_do(s, vq);
}
-static void virtio_blk_dma_restart_bh(void *opaque)
+void virtio_blk_process_queued_requests(VirtIOBlock *s)
{
- VirtIOBlock *s = opaque;
VirtIOBlockReq *req = s->rq;
MultiReqBuffer mrb = {};
- qemu_bh_delete(s->bh);
- s->bh = NULL;
-
s->rq = NULL;
aio_context_acquire(blk_get_aio_context(s->conf.conf.blk));
@@ -855,6 +851,16 @@ static void virtio_blk_dma_restart_bh(void *opaque)
aio_context_release(blk_get_aio_context(s->conf.conf.blk));
}
+static void virtio_blk_dma_restart_bh(void *opaque)
+{
+ VirtIOBlock *s = opaque;
+
+ qemu_bh_delete(s->bh);
+ s->bh = NULL;
+
+ virtio_blk_process_queued_requests(s);
+}
+
static void virtio_blk_dma_restart_cb(void *opaque, int running,
RunState state)
{
--
2.25.4
- [PULL 00/43] Block layer patches, Kevin Wolf, 2020/06/17
- [PULL 01/43] hw/ide: Make IDEDMAOps handlers take a const IDEDMA pointer, Kevin Wolf, 2020/06/17
- [PULL 04/43] virtio-blk: On restart, process queued requests in the proper context, Kevin Wolf, 2020/06/17
- [PULL 03/43] virtio-blk: Refactor the code that processes queued requests,
Kevin Wolf <=
- [PULL 02/43] icount: make dma reads deterministic, Kevin Wolf, 2020/06/17
- [PULL 06/43] qcow2: Tweak comments on qcow2_get_persistent_dirty_bitmap_size, Kevin Wolf, 2020/06/17
- [PULL 05/43] block: Refactor subdirectory recursion during make, Kevin Wolf, 2020/06/17
- [PULL 07/43] hw/block/nvme: fix pci doorbell size calculation, Kevin Wolf, 2020/06/17
- [PULL 09/43] hw/block/nvme: remove superfluous breaks, Kevin Wolf, 2020/06/17
- [PULL 10/43] hw/block/nvme: move device parameters to separate struct, Kevin Wolf, 2020/06/17
- [PULL 12/43] hw/block/nvme: refactor nvme_addr_read, Kevin Wolf, 2020/06/17
- [PULL 13/43] hw/block/nvme: fix pin-based interrupt behavior, Kevin Wolf, 2020/06/17
- [PULL 08/43] hw/block/nvme: rename trace events to pci_nvme, Kevin Wolf, 2020/06/17
- [PULL 16/43] hw/block/nvme: factor out property/constraint checks, Kevin Wolf, 2020/06/17