summaryrefslogtreecommitdiffstats
path: root/block/block-backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/block-backend.c')
-rw-r--r--block/block-backend.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index 15f1ea4288..6e37582740 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1957,12 +1957,12 @@ uint32_t blk_get_request_alignment(BlockBackend *blk)
uint32_t blk_get_max_transfer(BlockBackend *blk)
{
BlockDriverState *bs = blk_bs(blk);
- uint32_t max = 0;
+ uint32_t max = INT_MAX;
if (bs) {
- max = bs->bl.max_transfer;
+ max = MIN_NON_ZERO(max, bs->bl.max_transfer);
}
- return MIN_NON_ZERO(max, INT_MAX);
+ return ROUND_DOWN(max, blk_get_request_alignment(blk));
}
int blk_get_max_iov(BlockBackend *blk)