[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 02/29] block: Inherit opt_transfer_length
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH v3 02/29] block: Inherit opt_transfer_length |
Date: |
Fri, 17 Jan 2014 15:14:52 +0100 |
When there is a format driver between the backend, it's not guaranteed
that exposing the opt_transfer_length for the format driver results in
the optimal requests (because of fragmentation etc.), but it can't make
things worse, so let's just do it.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Wenchao Xia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 99e69da..20f85cb 100644
--- a/block.c
+++ b/block.c
@@ -485,7 +485,25 @@ static int bdrv_refresh_limits(BlockDriverState *bs)
memset(&bs->bl, 0, sizeof(bs->bl));
- if (drv && drv->bdrv_refresh_limits) {
+ if (!drv) {
+ return 0;
+ }
+
+ /* Take some limits from the children as a default */
+ if (bs->file) {
+ bdrv_refresh_limits(bs->file);
+ bs->bl.opt_transfer_length = bs->file->bl.opt_transfer_length;
+ }
+
+ if (bs->backing_hd) {
+ bdrv_refresh_limits(bs->backing_hd);
+ bs->bl.opt_transfer_length =
+ MAX(bs->bl.opt_transfer_length,
+ bs->backing_hd->bl.opt_transfer_length);
+ }
+
+ /* Then let the driver override it */
+ if (drv->bdrv_refresh_limits) {
return drv->bdrv_refresh_limits(bs);
}
--
1.8.1.4
- [Qemu-devel] [PATCH v3 00/29] block: Support for 512b-on-4k emulation, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 02/29] block: Inherit opt_transfer_length,
Kevin Wolf <=
- [Qemu-devel] [PATCH v3 03/29] block: Update BlockLimits when they might have changed, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 04/29] qemu_memalign: Allow small alignments, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 05/29] block: Detect unaligned length in bdrv_qiov_is_aligned(), Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 06/29] block: Don't use guest sector size for qemu_blockalign(), Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 08/29] raw: Probe required direct I/O alignment, Kevin Wolf, 2014/01/17