summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2015-02-02 14:52:19 +0100
committerKevin Wolf <kwolf@redhat.com>2015-02-06 17:24:21 +0100
commitd901f3c457ade0b4934427c0e8608dea31610720 (patch)
tree0d78922a6351ac368082c527c17277f4de2853ac
parentf4564d53c6952c61fb3ed8ee17a6e0f2f6bf0857 (diff)
downloadqemu-d901f3c457ade0b4934427c0e8608dea31610720.tar.gz
qemu-d901f3c457ade0b4934427c0e8608dea31610720.tar.bz2
qemu-d901f3c457ade0b4934427c0e8608dea31610720.zip
hw/virtio-blk: add a constant for max number of merged requests
As it was not obvious (at least for me) where the 32 comes from; add a constant for it. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--hw/block/virtio-blk.c2
-rw-r--r--include/hw/virtio/virtio-blk.h4
2 files changed, 4 insertions, 2 deletions
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index 4032fcae27..e04adb8f16 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -360,7 +360,7 @@ static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb)
block_acct_start(blk_get_stats(req->dev->blk), &req->acct, req->qiov.size,
BLOCK_ACCT_WRITE);
- if (mrb->num_writes == 32) {
+ if (mrb->num_writes == VIRTIO_BLK_MAX_MERGE_REQS) {
virtio_submit_multiwrite(req->dev->blk, mrb);
}
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
index 4652b70b5d..6ef3fa57cf 100644
--- a/include/hw/virtio/virtio-blk.h
+++ b/include/hw/virtio/virtio-blk.h
@@ -134,8 +134,10 @@ typedef struct VirtIOBlock {
struct VirtIOBlockDataPlane *dataplane;
} VirtIOBlock;
+#define VIRTIO_BLK_MAX_MERGE_REQS 32
+
typedef struct MultiReqBuffer {
- BlockRequest blkreq[32];
+ BlockRequest blkreq[VIRTIO_BLK_MAX_MERGE_REQS];
unsigned int num_writes;
} MultiReqBuffer;