From c99495ac1b4a27cb57bf04ed1a169177aeea2649 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 2 Feb 2015 14:52:22 +0100 Subject: [PATCH] virtio-blk: add a knob to disable request merging this adds a knob to disable request merging for debugging or benchmarks if dedired. Signed-off-by: Peter Lieven Signed-off-by: Kevin Wolf --- hw/block/virtio-blk.c | 5 ++++- include/hw/virtio/virtio-blk.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index d0a01a8864..8c51a295d9 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -531,7 +531,8 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb) /* merge would exceed maximum number of requests or IO direction * changes */ if (mrb->num_reqs > 0 && (mrb->num_reqs == VIRTIO_BLK_MAX_MERGE_REQS || - is_write != mrb->is_write)) { + is_write != mrb->is_write || + !req->dev->conf.request_merging)) { virtio_blk_submit_multireq(req->dev->blk, mrb); } @@ -950,6 +951,8 @@ static Property virtio_blk_properties[] = { #ifdef __linux__ DEFINE_PROP_BIT("scsi", VirtIOBlock, conf.scsi, 0, true), #endif + DEFINE_PROP_BIT("request-merging", VirtIOBlock, conf.request_merging, 0, + true), DEFINE_PROP_BIT("x-data-plane", VirtIOBlock, conf.data_plane, 0, false), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index 2027a64093..fc7d311a43 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -113,6 +113,7 @@ struct VirtIOBlkConf uint32_t scsi; uint32_t config_wce; uint32_t data_plane; + uint32_t request_merging; }; struct VirtIOBlockDataPlane;