[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v5 20/38] block: Prepare remaining BB functions

From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v5 20/38] block: Prepare remaining BB functions for NULL BDS
Date: Tue, 22 Sep 2015 16:35:51 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 18.09.2015 um 17:22 hat Max Reitz geschrieben:
> There are several BlockBackend functions which, in theory, cannot fail.
> This patch makes them cope with the BlockDriverState pointer being NULL
> by making them fall back to some default action like ignoring the value
> in setters and returning the default in getters.
> Signed-off-by: Max Reitz <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>

Hm, okay, maybe bdrv_drain() belongs here. I just reviewed the end
result for completeness and didn't check which patch did what.

>  int blk_enable_write_cache(BlockBackend *blk)
>  {
> +    if (!blk->bs) {
> +        return 0;
> +    }
> +
>      return bdrv_enable_write_cache(blk->bs);
>  }
>  void blk_set_enable_write_cache(BlockBackend *blk, bool wce)
>  {
> -    bdrv_set_enable_write_cache(blk->bs, wce);
> +    if (blk->bs) {
> +        bdrv_set_enable_write_cache(blk->bs, wce);
> +    }
>  }

WCE is part of the open_flags in BlockBackendRootState. The root state
doesn't seem to be used yet, and I wrote about my concerns about it in
reply to an earlier patch, but as long as we have it, should this
query/modify the root state if no BDS is attached?


reply via email to

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