[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 05/20] commit: Switch commit_populate() to by
From: |
Jeff Cody |
Subject: |
Re: [Qemu-devel] [PATCH v3 05/20] commit: Switch commit_populate() to byte-based |
Date: |
Fri, 30 Jun 2017 16:17:25 -0400 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Tue, Jun 27, 2017 at 02:24:43PM -0500, Eric Blake wrote:
> 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>
> ---
> v2: no change
> ---
> 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) {
> --
> 2.9.4
>
- Re: [Qemu-devel] [PATCH v3 01/20] blockjob: Track job ratelimits via bytes, not sectors, (continued)
- [Qemu-devel] [PATCH v3 03/20] stream: Switch stream_populate() to byte-based, Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 02/20] trace: Show blockjob actions via bytes, not sectors, Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 04/20] stream: Switch stream_run() to byte-based, Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 06/20] commit: Switch commit_run() to byte-based, Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 05/20] commit: Switch commit_populate() to byte-based, Eric Blake, 2017/06/27
- Re: [Qemu-devel] [PATCH v3 05/20] commit: Switch commit_populate() to byte-based,
Jeff Cody <=
- [Qemu-devel] [PATCH v3 08/20] mirror: Switch mirror_do_zero_or_discard() to byte-based, Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 07/20] mirror: Switch MirrorBlockJob to byte-based, Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 09/20] mirror: Update signature of mirror_clip_sectors(), Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 10/20] mirror: Switch mirror_cow_align() to byte-based, Eric Blake, 2017/06/27
- [Qemu-devel] [PATCH v3 11/20] mirror: Switch mirror_do_read() to byte-based, Eric Blake, 2017/06/27