Skip to content

Commit 04a11d8

Browse files
ebblakekevmw
authored andcommitted
replication: Switch to byte-based calls
We are gradually moving away from sector-based interfaces, towards byte-based. Make the change for the last few sector-based calls into the block layer from the replication driver. Ideally, the replication driver should switch to doing everything byte-based, but that's a more invasive change that requires a bit more auditing. Signed-off-by: Eric Blake <[email protected]> Reviewed-by: Jeff Cody <[email protected]> Signed-off-by: Kevin Wolf <[email protected]>
1 parent 609841a commit 04a11d8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

block/replication.c

+8-6
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,14 @@ static coroutine_fn int replication_co_readv(BlockDriverState *bs,
246246
backup_cow_request_begin(&req, child->bs->job,
247247
sector_num * BDRV_SECTOR_SIZE,
248248
remaining_bytes);
249-
ret = bdrv_co_readv(bs->file, sector_num, remaining_sectors,
250-
qiov);
249+
ret = bdrv_co_preadv(bs->file, sector_num * BDRV_SECTOR_SIZE,
250+
remaining_bytes, qiov, 0);
251251
backup_cow_request_end(&req);
252252
goto out;
253253
}
254254

255-
ret = bdrv_co_readv(bs->file, sector_num, remaining_sectors, qiov);
255+
ret = bdrv_co_preadv(bs->file, sector_num * BDRV_SECTOR_SIZE,
256+
remaining_sectors * BDRV_SECTOR_SIZE, qiov, 0);
256257
out:
257258
return replication_return_value(s, ret);
258259
}
@@ -279,8 +280,8 @@ static coroutine_fn int replication_co_writev(BlockDriverState *bs,
279280
}
280281

281282
if (ret == 0) {
282-
ret = bdrv_co_writev(top, sector_num,
283-
remaining_sectors, qiov);
283+
ret = bdrv_co_pwritev(top, sector_num * BDRV_SECTOR_SIZE,
284+
remaining_sectors * BDRV_SECTOR_SIZE, qiov, 0);
284285
return replication_return_value(s, ret);
285286
}
286287

@@ -306,7 +307,8 @@ static coroutine_fn int replication_co_writev(BlockDriverState *bs,
306307
qemu_iovec_concat(&hd_qiov, qiov, bytes_done, count);
307308

308309
target = ret ? top : base;
309-
ret = bdrv_co_writev(target, sector_num, n, &hd_qiov);
310+
ret = bdrv_co_pwritev(target, sector_num * BDRV_SECTOR_SIZE,
311+
n * BDRV_SECTOR_SIZE, &hd_qiov, 0);
310312
if (ret < 0) {
311313
goto out1;
312314
}

0 commit comments

Comments
 (0)