Skip to content

Commit 7aa1c24

Browse files
slpkevmw
authored andcommitted
virtio-blk: Refactor the code that processes queued requests
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>
1 parent 5fb0a6b commit 7aa1c24

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

hw/block/virtio-blk.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -819,15 +819,11 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq)
819819
virtio_blk_handle_output_do(s, vq);
820820
}
821821

822-
static void virtio_blk_dma_restart_bh(void *opaque)
822+
void virtio_blk_process_queued_requests(VirtIOBlock *s)
823823
{
824-
VirtIOBlock *s = opaque;
825824
VirtIOBlockReq *req = s->rq;
826825
MultiReqBuffer mrb = {};
827826

828-
qemu_bh_delete(s->bh);
829-
s->bh = NULL;
830-
831827
s->rq = NULL;
832828

833829
aio_context_acquire(blk_get_aio_context(s->conf.conf.blk));
@@ -855,6 +851,16 @@ static void virtio_blk_dma_restart_bh(void *opaque)
855851
aio_context_release(blk_get_aio_context(s->conf.conf.blk));
856852
}
857853

854+
static void virtio_blk_dma_restart_bh(void *opaque)
855+
{
856+
VirtIOBlock *s = opaque;
857+
858+
qemu_bh_delete(s->bh);
859+
s->bh = NULL;
860+
861+
virtio_blk_process_queued_requests(s);
862+
}
863+
858864
static void virtio_blk_dma_restart_cb(void *opaque, int running,
859865
RunState state)
860866
{

include/hw/virtio/virtio-blk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,6 @@ typedef struct MultiReqBuffer {
8686
} MultiReqBuffer;
8787

8888
bool virtio_blk_handle_vq(VirtIOBlock *s, VirtQueue *vq);
89+
void virtio_blk_process_queued_requests(VirtIOBlock *s);
8990

9091
#endif

0 commit comments

Comments
 (0)