[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 025/100] commit: Switch commit_populate() to byte-bas
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 025/100] commit: Switch commit_populate() to byte-based |
Date: |
Fri, 7 Jul 2017 19:07:40 +0200 |
From: Eric Blake <address@hidden>
We are gradually converting to byte-based interfaces, as they are
easier to reason about than sector-based. Start by converting an
internal function (no semantic change).
Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/commit.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/block/commit.c b/block/commit.c
index 4cda7f2..6f67d78 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -47,26 +47,25 @@ typedef struct CommitBlockJob {
} CommitBlockJob;
static int coroutine_fn commit_populate(BlockBackend *bs, BlockBackend *base,
- int64_t sector_num, int nb_sectors,
+ int64_t offset, uint64_t bytes,
void *buf)
{
int ret = 0;
QEMUIOVector qiov;
struct iovec iov = {
.iov_base = buf,
- .iov_len = nb_sectors * BDRV_SECTOR_SIZE,
+ .iov_len = bytes,
};
+ assert(bytes < SIZE_MAX);
qemu_iovec_init_external(&qiov, &iov, 1);
- ret = blk_co_preadv(bs, sector_num * BDRV_SECTOR_SIZE,
- qiov.size, &qiov, 0);
+ ret = blk_co_preadv(bs, offset, qiov.size, &qiov, 0);
if (ret < 0) {
return ret;
}
- ret = blk_co_pwritev(base, sector_num * BDRV_SECTOR_SIZE,
- qiov.size, &qiov, 0);
+ ret = blk_co_pwritev(base, offset, qiov.size, &qiov, 0);
if (ret < 0) {
return ret;
}
@@ -193,7 +192,9 @@ static void coroutine_fn commit_run(void *opaque)
trace_commit_one_iteration(s, sector_num * BDRV_SECTOR_SIZE,
n * BDRV_SECTOR_SIZE, ret);
if (copy) {
- ret = commit_populate(s->top, s->base, sector_num, n, buf);
+ ret = commit_populate(s->top, s->base,
+ sector_num * BDRV_SECTOR_SIZE,
+ n * BDRV_SECTOR_SIZE, buf);
bytes_written += n * BDRV_SECTOR_SIZE;
}
if (ret < 0) {
--
1.8.3.1
- [Qemu-devel] [PULL 017/100] vvfat: change OEM name to 'MSWIN4.1', (continued)
- [Qemu-devel] [PULL 017/100] vvfat: change OEM name to 'MSWIN4.1', Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 019/100] blockdev: Print a warning for legacy drive options that belong to -device, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 020/100] blockjob: Track job ratelimits via bytes, not sectors, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 014/100] vvfat: correctly generate numeric-tail of short file names, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 018/100] qemu-img: drop -e and -6 options from the 'create' & 'convert' commands, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 022/100] stream: Switch stream_populate() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 023/100] stream: Drop reached_end for stream_complete(), Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 021/100] trace: Show blockjob actions via bytes, not sectors, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 024/100] stream: Switch stream_run() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 029/100] mirror: Update signature of mirror_clip_sectors(), Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 025/100] commit: Switch commit_populate() to byte-based,
Kevin Wolf <=
- [Qemu-devel] [PULL 026/100] commit: Switch commit_run() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 030/100] mirror: Switch mirror_cow_align() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 027/100] mirror: Switch MirrorBlockJob to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 006/100] vvfat: replace tabs by 8 spaces, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 028/100] mirror: Switch mirror_do_zero_or_discard() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 031/100] mirror: Switch mirror_do_read() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 033/100] block: Drop unused bdrv_round_sectors_to_clusters(), Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 034/100] backup: Switch BackupBlockJob to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 037/100] backup: Switch backup_run() to byte-based, Kevin Wolf, 2017/07/07
- [Qemu-devel] [PULL 032/100] mirror: Switch mirror_iteration() to byte-based, Kevin Wolf, 2017/07/07