diff options
author | Kevin Wolf <kwolf@redhat.com> | 2013-12-11 19:50:32 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-01-24 17:40:01 +0100 |
commit | 466ad822deef3a03757d505218a52993c5d56b5d (patch) | |
tree | b92cdf86a640a7c972ba6172fe7cc4895eb9caa4 /block.c | |
parent | d34682cd4a06efe9ee3fc8cb7e8a0ea445299989 (diff) | |
download | qemu-466ad822deef3a03757d505218a52993c5d56b5d.zip qemu-466ad822deef3a03757d505218a52993c5d56b5d.tar.gz qemu-466ad822deef3a03757d505218a52993c5d56b5d.tar.bz2 |
block: Inherit opt_transfer_length
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 <kwolf@redhat.com>
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: BenoƮt Canet <benoit@irqsave.net>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -489,7 +489,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); } |