[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 02/10] block: add BlockLimits.max_iov field
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 02/10] block: add BlockLimits.max_iov field |
Date: |
Tue, 22 Dec 2015 16:54:12 +0800 |
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 <address@hidden>
Suggested-by: Kevin Wolf <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/io.c | 7 +++++++
include/block/block_int.h | 3 +++
2 files changed, 10 insertions(+)
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 */
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 9a1c466..256609d 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -330,6 +330,9 @@ typedef struct BlockLimits {
/* memory alignment for bounce buffer */
size_t opt_mem_alignment;
+
+ /* maximum number of iovec elements */
+ int max_iov;
} BlockLimits;
typedef struct BdrvOpBlocker BdrvOpBlocker;
--
2.5.0
- [Qemu-devel] [PULL 00/10] Block patches, Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 01/10] virtio-blk: trivial code optimization, Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 02/10] block: add BlockLimits.max_iov field,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 03/10] block-backend: add blk_get_max_iov(), Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 04/10] block: replace IOV_MAX with BlockLimits.max_iov, Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 05/10] block/mirror: replace IOV_MAX with blk_get_max_iov(), Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 06/10] parallels: add format spec, Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 07/10] scripts/gdb: Fix a python exception in mtree.py, Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 08/10] sd: sdhci: Delete over-zealous power check, Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 09/10] sdhci: don't raise a command index error for an unexpected response, Stefan Hajnoczi, 2015/12/22
- [Qemu-devel] [PULL 10/10] sdhci: add optional quirk property to disable card insertion/removal interrupts, Stefan Hajnoczi, 2015/12/22
- Re: [Qemu-devel] [PULL 00/10] Block patches, Peter Maydell, 2015/12/22