Skip to content

Commit 944e7c8

Browse files
committed
virtio_blk: implement mq_ops->commit_rqs() hook
We need this for blk-mq to kick things into gear, if we told it that we had more IO coming, but then failed to deliver on that promise. Reviewed-by: Omar Sandoval <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 04f3eaf commit 944e7c8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/block/virtio_blk.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,20 @@ static void virtblk_done(struct virtqueue *vq)
214214
spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags);
215215
}
216216

217+
static void virtio_commit_rqs(struct blk_mq_hw_ctx *hctx)
218+
{
219+
struct virtio_blk *vblk = hctx->queue->queuedata;
220+
struct virtio_blk_vq *vq = &vblk->vqs[hctx->queue_num];
221+
bool kick;
222+
223+
spin_lock_irq(&vq->lock);
224+
kick = virtqueue_kick_prepare(vq->vq);
225+
spin_unlock_irq(&vq->lock);
226+
227+
if (kick)
228+
virtqueue_notify(vq->vq);
229+
}
230+
217231
static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx,
218232
const struct blk_mq_queue_data *bd)
219233
{
@@ -638,6 +652,7 @@ static void virtblk_initialize_rq(struct request *req)
638652

639653
static const struct blk_mq_ops virtio_mq_ops = {
640654
.queue_rq = virtio_queue_rq,
655+
.commit_rqs = virtio_commit_rqs,
641656
.complete = virtblk_request_done,
642657
.init_request = virtblk_init_request,
643658
#ifdef CONFIG_VIRTIO_BLK_SCSI

0 commit comments

Comments
 (0)