[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/6] qcow2: Update total_sectors when resizing t
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 4/6] qcow2: Update total_sectors when resizing the image |
Date: |
Mon, 30 Jul 2018 11:43:20 +0200 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
Am 29.07.2018 um 23:27 hat Leonid Bloch geschrieben:
> Signed-off-by: Leonid Bloch <address@hidden>
> ---
> block/qcow2.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index ec9e6238a0..223d351e40 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -3646,6 +3646,8 @@ static int coroutine_fn
> qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
> }
> }
>
> + bs->total_sectors = offset / 512;
> +
> /* write updated header.size */
> offset = cpu_to_be64(offset);
> ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size),
This shouldn't be necessary, bdrv_co_truncate() already updates
bs->total_sectors after calling the block driver.
If this is needed by one of the following patches, we need a comment
that explains why this seemingly superfluous assignment is actually
necessary.
Also, 512 should be BDRV_SECTOR_SIZE.
Kevin
- [Qemu-devel] [PATCH 0/6] qcow2: Make the L2 cache cover the whole image by default, Leonid Bloch, 2018/07/29
- [Qemu-devel] [PATCH 5/6] qcow2: Make the default L2 cache sufficient to cover the entire image, Leonid Bloch, 2018/07/29
- [Qemu-devel] [PATCH 1/6 for-3.0] Update .gitignore, Leonid Bloch, 2018/07/29
- [Qemu-devel] [PATCH 6/6] qcow2: Resize the cache upon image resizing, Leonid Bloch, 2018/07/29
- [Qemu-devel] [PATCH 2/6 for-3.0] qcow2: A grammar fix in conflicting cache sizing error message, Leonid Bloch, 2018/07/29
- [Qemu-devel] [PATCH 3/6 for-3.0] qcow2: Options' documentation fixes, Leonid Bloch, 2018/07/29
- [Qemu-devel] [PATCH 4/6] qcow2: Update total_sectors when resizing the image, Leonid Bloch, 2018/07/29
- Re: [Qemu-devel] [PATCH 4/6] qcow2: Update total_sectors when resizing the image,
Kevin Wolf <=
- Re: [Qemu-devel] [PATCH 0/6] qcow2: Make the L2 cache cover the whole image by default, Kevin Wolf, 2018/07/30