summaryrefslogtreecommitdiffstats
path: root/block/io.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2015-07-09 10:56:44 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:20 -0600
commitaaeb3a609de0b3a8d7e8dc1ca3a1c6a5735a28a8 (patch)
treea332bd5906f878580df65521655f4efa3496da5d /block/io.c
parenta6685041cc35ed9c5fb106db5f4498b7c5060979 (diff)
downloadhqemu-aaeb3a609de0b3a8d7e8dc1ca3a1c6a5735a28a8.zip
hqemu-aaeb3a609de0b3a8d7e8dc1ca3a1c6a5735a28a8.tar.gz
block: add BlockLimits.max_iov field
The maximum number of struct iovec elements depends on the BlockDriverState. The raw-posix and iSCSI protocols have a maximum of IOV_MAX but others could have different values. Cc: Peter Lieven <pl@kamp.de> Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/io.c')
-rw-r--r--block/io.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/io.c b/block/io.c
index 841f5b5..42050a0 100644
--- a/block/io.c
+++ b/block/io.c
@@ -166,9 +166,13 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp)
bs->bl.max_transfer_length = bs->file->bs->bl.max_transfer_length;
bs->bl.min_mem_alignment = bs->file->bs->bl.min_mem_alignment;
bs->bl.opt_mem_alignment = bs->file->bs->bl.opt_mem_alignment;
+ bs->bl.max_iov = bs->file->bs->bl.max_iov;
} else {
bs->bl.min_mem_alignment = 512;
bs->bl.opt_mem_alignment = getpagesize();
+
+ /* Safe default since most protocols use readv()/writev()/etc */
+ bs->bl.max_iov = IOV_MAX;
}
if (bs->backing) {
@@ -189,6 +193,9 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp)
bs->bl.min_mem_alignment =
MAX(bs->bl.min_mem_alignment,
bs->backing->bs->bl.min_mem_alignment);
+ bs->bl.max_iov =
+ MIN(bs->bl.max_iov,
+ bs->backing->bs->bl.max_iov);
}
/* Then let the driver override it */
OpenPOWER on IntegriCloud