Skip to content

Commit cbf1dff

Browse files
committed
block: Fix multiwrite with overlapping requests
With overlapping requests, the total number of sectors is smaller than the sum of the nb_sectors of both requests. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 parent 175e115 commit cbf1dff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2019,7 +2019,7 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs,
20192019
// Add the second request
20202020
qemu_iovec_concat(qiov, reqs[i].qiov, reqs[i].qiov->size);
20212021

2022-
reqs[outidx].nb_sectors += reqs[i].nb_sectors;
2022+
reqs[outidx].nb_sectors = qiov->size >> 9;
20232023
reqs[outidx].qiov = qiov;
20242024

20252025
mcb->callbacks[i].free_qiov = reqs[outidx].qiov;

0 commit comments

Comments
 (0)