Skip to content

Commit

Permalink
virtio-blk: Refactor the code that processes queued requests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
slp authored and kevmw committed Jun 17, 2020
1 parent 5fb0a6b commit 7aa1c24
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions hw/block/virtio-blk.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions include/hw/virtio/virtio-blk.h
Expand Up @@ -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

0 comments on commit 7aa1c24

Please sign in to comment.