[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB leve
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB level |
Date: |
Sat, 26 Mar 2016 20:54:05 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 |
On 18.03.2016 19:21, Kevin Wolf wrote:
> Whether a write cache is used or not is a decision that concerns the
> user (e.g. the guest device) rather than the backend. It was already
> logically part of the BB level as bdrv_move_feature_fields() always kept
> it on top of the BDS tree; with this patch, the core of it (the actual
> flag and the additional flushes) is also implemented there.
>
> Direct callers of bdrv_open() must pass BDRV_O_CACHE_WB now if bs
> doesn't have a BlockBackend attached.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> block.c | 26 +++++++++++++++++---------
> block/block-backend.c | 42 +++++++++++++++++++++++++++---------------
> block/io.c | 2 +-
> block/iscsi.c | 2 +-
> include/block/block.h | 1 +
> include/block/block_int.h | 3 ---
> tests/qemu-iotests/142 | 4 ++--
> tests/qemu-iotests/142.out | 8 ++++----
> 8 files changed, 53 insertions(+), 35 deletions(-)
Reviewed-by: Max Reitz <address@hidden>
I'm not so sure about the state bdrv_{set_,}enable_write_cache() are in
after this patch (e.g. the NBD client will always think the write cache
is enabled; and bdrv_set_enable_write_cache() can be used to unset
BDRV_O_CACHE_WB on BDSs), but looking at the following patches' titles,
they'll clear that up.
It appears to me that multiwrite will ignore the writethrough status,
but then again, qemu-io seems to be the only multiwrite user.
> diff --git a/block.c b/block.c
> index 172f865..9271dbb 100644
> --- a/block.c
> +++ b/block.c
[...]
> @@ -3618,8 +3626,8 @@ void bdrv_img_create(const char *filename, const char
> *fmt,
> }
>
> /* backing files always opened read-only */
> - back_flags =
> - flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
> + back_flags = flags | BDRV_O_CACHE_WB;
> + back_flags &= ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT |
> BDRV_O_NO_BACKING);
Actually, this is the only thing the @flags parameter of this function
is used for. Maybe it can be dropped since we already regulate the
back_flags pretty strictly.
>
> if (backing_fmt) {
> backing_options = qdict_new();
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 06/20] xen_disk: Call blk_set_enable_write_cache() explicitly, (continued)
- [Qemu-devel] [PATCH 09/20] block: Handle flush error in bdrv_pwrite_sync(), Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 05/20] qemu-img: Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 07/20] block: blockdev_init(): Call blk_set_enable_write_cache() explicitly, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 08/20] block: Always set writeback mode in blk_new_open(), Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB level, Kevin Wolf, 2016/03/18
- Re: [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB level,
Max Reitz <=
- [Qemu-devel] [PATCH 16/20] block: Use bdrv_parse_cache_mode() in drive_init(), Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 15/20] raw: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 12/20] block: Introduce bdrv_co_writev_flags(), Kevin Wolf, 2016/03/18
- [Qemu-devel] [PATCH 13/20] iscsi: Support BDRV_REQ_FUA, Kevin Wolf, 2016/03/18