mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
hw/block: Introduce share-rw qdev property
By default, don't allow another writer for block devices that are attached to a guest device. For the cases where this setup is intended (e.g. using a cluster filesystem on the disk), the new option can be used to allow it. This change affects only devices using DEFINE_BLOCK_PROPERTIES(). Devices directly using DEFINE_PROP_DRIVE() still accept writers unconditionally. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Acked-by: Fam Zheng <famz@redhat.com>
This commit is contained in:
parent
a17c17a274
commit
dabd18f64c
3 changed files with 61 additions and 3 deletions
|
@ -26,6 +26,7 @@ typedef struct BlockConf {
|
|||
/* geometry, not all devices use this */
|
||||
uint32_t cyls, heads, secs;
|
||||
OnOffAuto wce;
|
||||
bool share_rw;
|
||||
BlockdevOnError rerror;
|
||||
BlockdevOnError werror;
|
||||
} BlockConf;
|
||||
|
@ -53,7 +54,9 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
|
|||
DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \
|
||||
DEFINE_PROP_UINT32("discard_granularity", _state, \
|
||||
_conf.discard_granularity, -1), \
|
||||
DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, ON_OFF_AUTO_AUTO)
|
||||
DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, \
|
||||
ON_OFF_AUTO_AUTO), \
|
||||
DEFINE_PROP_BOOL("share-rw", _state, _conf.share_rw, false)
|
||||
|
||||
#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \
|
||||
DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue