[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v5 20/38] block: Prepare remaining BB functions
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-block] [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?
Kevin
- [Qemu-block] [PATCH v5 17/38] block: Add BlockBackendRootState, (continued)
- [Qemu-block] [PATCH v5 20/38] block: Prepare remaining BB functions for NULL BDS, Max Reitz, 2015/09/18
- Re: [Qemu-block] [PATCH v5 20/38] block: Prepare remaining BB functions for NULL BDS,
Kevin Wolf <=
- [Qemu-block] [PATCH v5 21/38] block: Add blk_insert_bs(), Max Reitz, 2015/09/18
- [Qemu-block] [PATCH v5 22/38] block: Prepare for NULL BDS, Max Reitz, 2015/09/18
- [Qemu-block] [PATCH v5 23/38] blockdev: Do not create BDS for empty drive, Max Reitz, 2015/09/18
- [Qemu-block] [PATCH v5 24/38] blockdev: Pull out blockdev option extraction, Max Reitz, 2015/09/18
- [Qemu-block] [PATCH v5 26/38] block: Add blk_remove_bs(), Max Reitz, 2015/09/18
- [Qemu-block] [PATCH v5 25/38] blockdev: Allow more options for BB-less BDS tree, Max Reitz, 2015/09/18