[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 03/29] block: Update BlockLimits when they mi
From: |
Benoît Canet |
Subject: |
Re: [Qemu-devel] [PATCH v3 03/29] block: Update BlockLimits when they might have changed |
Date: |
Fri, 17 Jan 2014 23:47:34 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Le Friday 17 Jan 2014 à 15:14:53 (+0100), Kevin Wolf a écrit :
> When reopening with different flags, or when backing files disappear
> from the chain, the limits may change. Make sure they get updated in
> these cases.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> Reviewed-by: Wenchao Xia <address@hidden>
> Reviewed-by: Max Reitz <address@hidden>
> ---
> block.c | 5 ++++-
> block/stream.c | 2 ++
> include/block/block.h | 1 +
> 3 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/block.c b/block.c
> index 20f85cb..9a8562d 100644
> --- a/block.c
> +++ b/block.c
> @@ -479,7 +479,7 @@ int bdrv_create_file(const char* filename,
> QEMUOptionParameter *options,
> return ret;
> }
>
> -static int bdrv_refresh_limits(BlockDriverState *bs)
> +int bdrv_refresh_limits(BlockDriverState *bs)
> {
> BlockDriver *drv = bs->drv;
>
> @@ -1464,6 +1464,8 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state)
> reopen_state->bs->enable_write_cache = !!(reopen_state->flags &
> BDRV_O_CACHE_WB);
> reopen_state->bs->read_only = !(reopen_state->flags & BDRV_O_RDWR);
> +
> + bdrv_refresh_limits(reopen_state->bs);
> }
>
> /*
> @@ -2261,6 +2263,7 @@ int bdrv_drop_intermediate(BlockDriverState *active,
> BlockDriverState *top,
> }
> new_top_bs->backing_hd = base_bs;
>
> + bdrv_refresh_limits(new_top_bs);
>
> QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry,
> next) {
> /* so that bdrv_close() does not recursively close the chain */
> diff --git a/block/stream.c b/block/stream.c
> index 46bec7d..dd0b4ac 100644
> --- a/block/stream.c
> +++ b/block/stream.c
> @@ -75,6 +75,8 @@ static void close_unused_images(BlockDriverState *top,
> BlockDriverState *base,
> unused->backing_hd = NULL;
> bdrv_unref(unused);
> }
> +
> + bdrv_refresh_limits(top);
> }
>
> static void coroutine_fn stream_run(void *opaque)
> diff --git a/include/block/block.h b/include/block/block.h
> index 36efaea..64fb319 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -249,6 +249,7 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset);
> int64_t bdrv_getlength(BlockDriverState *bs);
> int64_t bdrv_get_allocated_file_size(BlockDriverState *bs);
> void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
> +int bdrv_refresh_limits(BlockDriverState *bs);
> int bdrv_commit(BlockDriverState *bs);
> int bdrv_commit_all(void);
> int bdrv_change_backing_file(BlockDriverState *bs,
> --
> 1.8.1.4
>
Reviewed-by: Benoît Canet <address@hidden>
>
- [Qemu-devel] [PATCH v3 00/29] block: Support for 512b-on-4k emulation, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 02/29] block: Inherit opt_transfer_length, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 03/29] block: Update BlockLimits when they might have changed, Kevin Wolf, 2014/01/17
- Re: [Qemu-devel] [PATCH v3 03/29] block: Update BlockLimits when they might have changed,
Benoît Canet <=
- [Qemu-devel] [PATCH v3 04/29] qemu_memalign: Allow small alignments, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 05/29] block: Detect unaligned length in bdrv_qiov_is_aligned(), Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 06/29] block: Don't use guest sector size for qemu_blockalign(), Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 08/29] raw: Probe required direct I/O alignment, Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 09/29] block: Introduce bdrv_aligned_preadv(), Kevin Wolf, 2014/01/17
- [Qemu-devel] [PATCH v3 10/29] block: Introduce bdrv_co_do_preadv(), Kevin Wolf, 2014/01/17