[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 03/16] block: Framework for reopening files s
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 03/16] block: Framework for reopening files safely |
Date: |
Thu, 13 Sep 2012 18:20:28 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0 |
Il 13/09/2012 17:49, Jeff Cody ha scritto:
> + reopen_state->bs->open_flags = reopen_state->flags;
> + reopen_state->bs->enable_write_cache = !!(reopen_state->flags &
> + BDRV_O_CACHE_WB);
I think setting enable_write_cache is wrong here because this is really
part of the guest state, not the host state (yes, it's a mess).
Instead, you could proceed like this:
1) change bdrv_enable_write_cache like this:
int bdrv_enable_write_cache(BlockDriverState *bs)
{
return bs->enable_write_cache && (bs->open_flags & BDRV_O_CACHE_WB);
}
and use it in block.c instead of checking bs->enable_write_cache directly;
2) always initialize bs->enable_write_cache to true, rather than to the
value of BDRV_O_CACHE_WB;
This way bs->enable_write_cache is _really_ guest state rather than a mix.
3) never touch enable_write_cache in bdrv_reopen.
Paolo
- [Qemu-devel] [PATCH v2 00/16] block: bdrv_reopen() patches, Jeff Cody, 2012/09/13
- [Qemu-devel] [PATCH v2 01/16] block: correctly set the keep_read_only flag, Jeff Cody, 2012/09/13
- [Qemu-devel] [PATCH v2 02/16] block: make bdrv_set_enable_write_cache() modify open_flags, Jeff Cody, 2012/09/13
- [Qemu-devel] [PATCH v2 03/16] block: Framework for reopening files safely, Jeff Cody, 2012/09/13
- [Qemu-devel] [PATCH v2 04/16] block: move aio initialization into a helper function, Jeff Cody, 2012/09/13
- [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers, Jeff Cody, 2012/09/13
- Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers, Paolo Bonzini, 2012/09/13
- Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers, Jeff Cody, 2012/09/13
- Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers, Paolo Bonzini, 2012/09/13
- Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers, Jeff Cody, 2012/09/13
- Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers, Paolo Bonzini, 2012/09/13
- Re: [Qemu-devel] [PATCH v2 06/16] block: do not parse BDRV_O_CACHE_WB in raw block drivers, Paolo Bonzini, 2012/09/13