[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v3 3/5] qcow2: Resize the cache upon image resiz
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-block] [PATCH v3 3/5] qcow2: Resize the cache upon image resizing |
Date: |
Wed, 08 Aug 2018 16:13:29 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Wed 08 Aug 2018 09:10:49 AM CEST, Leonid Bloch wrote:
> The caches are now recalculated upon image resizing. This is done
> because the new default behavior of assigning a sufficient L2 cache to
> cover the entire image implies that the cache will still be sufficient
> after an image resizing.
This is related to what I mentioned in the previous patch. The default
behavior doesn't make the cache try to cover the entire image (or at
least it doesn't *extend* the cache, which is what I understand from
this paragraph). What it does is *reduce* the cache if the smaller
version is enough for the entire image.
> Signed-off-by: Leonid Bloch <address@hidden>
> ---
> block/qcow2.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 98cb96aaca..f60cb92169 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -3639,6 +3639,8 @@ static int coroutine_fn
> qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
> }
> }
>
> + bs->total_sectors = offset / BDRV_SECTOR_SIZE;
> +
> /* write updated header.size */
> offset = cpu_to_be64(offset);
> ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size),
> @@ -3649,6 +3651,12 @@ static int coroutine_fn
> qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
> }
>
> s->l1_vm_state_index = new_l1_size;
You could add an empty line here for readability.
> + /* Update cache sizes */
> + QDict *options = qdict_clone_shallow(bs->options);
C99 allows variable declarations in the middle of a block, but we're
still doing it at the beginning (I don't know if there's a good reason
for this?).
Otherwise the patch looks good to me. Thanks!
Berto
[Qemu-block] [PATCH v3 4/5] qcow2: Set the default cache-clean-interval to 30 seconds, Leonid Bloch, 2018/08/08
[Qemu-block] [PATCH v3 3/5] qcow2: Resize the cache upon image resizing, Leonid Bloch, 2018/08/08
- Re: [Qemu-block] [PATCH v3 3/5] qcow2: Resize the cache upon image resizing,
Alberto Garcia <=
[Qemu-block] [PATCH v3 5/5] qcow2: Explicit number replaced by a constant, Leonid Bloch, 2018/08/08