qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 13/14] block: Remove "growable" from BDS


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v3 13/14] block: Remove "growable" from BDS
Date: Mon, 2 Feb 2015 20:46:58 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Am 26.01.2015 um 16:00 hat Max Reitz geschrieben:
> Now that request clamping is done in the BlockBackend, the "growable"
> field can be removed from the BlockDriverState. All BDSs are now treated
> as being "growable" (that is, they are allowed to grow; they are not
> necessarily actually able to).
> 
> Signed-off-by: Max Reitz <address@hidden>
> ---
>  block.c                   | 24 +++++-------------------
>  block/qcow2.c             |  6 ------
>  block/raw-posix.c         |  2 +-
>  block/raw-win32.c         |  2 +-
>  block/sheepdog.c          |  2 +-
>  include/block/block_int.h |  3 ---
>  6 files changed, 8 insertions(+), 31 deletions(-)
> 
> diff --git a/block.c b/block.c
> index d45e4dd..356a857 100644
> --- a/block.c
> +++ b/block.c
> @@ -970,7 +970,6 @@ static int bdrv_open_common(BlockDriverState *bs, 
> BlockDriverState *file,
>      bs->zero_beyond_eof = true;
>      open_flags = bdrv_open_flags(bs, flags);
>      bs->read_only = !(open_flags & BDRV_O_RDWR);
> -    bs->growable = !!(flags & BDRV_O_PROTOCOL);
>  
>      if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
>          error_setg(errp,
> @@ -1885,7 +1884,6 @@ void bdrv_close(BlockDriverState *bs)
>          bs->encrypted = 0;
>          bs->valid_key = 0;
>          bs->sg = 0;
> -        bs->growable = 0;
>          bs->zero_beyond_eof = false;
>          QDECREF(bs->options);
>          bs->options = NULL;
> @@ -2645,25 +2643,13 @@ exit:
>  static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,
>                                     size_t size)
>  {
> -    int64_t len;
> -
>      if (size > INT_MAX) {
>          return -EIO;
>      }
>  
> -    if (!bdrv_is_inserted(bs))
> +    if (!bdrv_is_inserted(bs)) {
>          return -ENOMEDIUM;
> -
> -    if (bs->growable)
> -        return 0;
> -
> -    len = bdrv_getlength(bs);
> -
> -    if (offset < 0)
> -        return -EIO;

Wouldn't it be better to keep this one, even though bs->growable used to
disable it?

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]