Commit 466ad822 authored by Kevin Wolf's avatar Kevin Wolf

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: default avatarKevin Wolf <>
Reviewed-by: default avatarWenchao Xia <>
Reviewed-by: default avatarMax Reitz <>
Reviewed-by: default avatarBenoît Canet <>
parent d34682cd
......@@ -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) {
bs->bl.opt_transfer_length = bs->file->bl.opt_transfer_length;
if (bs->backing_hd) {
bs->bl.opt_transfer_length =
/* Then let the driver override it */
if (drv->bdrv_refresh_limits) {
return drv->bdrv_refresh_limits(bs);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment