mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
block: Rewrite the snapshot authorization mechanism for block filters.
This patch keep the recursive way of doing things but simplify it by giving two responsabilities to all block filters implementors. They will need to do two things: -Set the is_filter field of their block driver to true. -Implement the bdrv_recurse_is_first_non_filter method of their block driver like it is done on the Quorum block driver. (block/quorum.c) [Paolo Bonzini <pbonzini@redhat.com> pointed out that this patch changes the semantics of blkverify, which now recurses down both bs->file and s->test_file. -- Stefan] Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
98d39e34fe
commit
b5042a3622
5 changed files with 46 additions and 46 deletions
|
@ -286,15 +286,6 @@ int bdrv_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix);
|
|||
int bdrv_amend_options(BlockDriverState *bs_new, QEMUOptionParameter *options);
|
||||
|
||||
/* external snapshots */
|
||||
|
||||
typedef enum {
|
||||
BS_IS_A_FILTER,
|
||||
BS_FILTER_PASS_DOWN,
|
||||
BS_AUTHORIZATION_COUNT,
|
||||
} BsAuthorization;
|
||||
|
||||
bool bdrv_generic_is_first_non_filter(BlockDriverState *bs,
|
||||
BlockDriverState *candidate);
|
||||
bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs,
|
||||
BlockDriverState *candidate);
|
||||
bool bdrv_is_first_non_filter(BlockDriverState *candidate);
|
||||
|
|
|
@ -76,10 +76,10 @@ struct BlockDriver {
|
|||
const char *format_name;
|
||||
int instance_size;
|
||||
|
||||
/* this table of boolean contains authorizations for the block operations */
|
||||
bool authorizations[BS_AUTHORIZATION_COUNT];
|
||||
/* for snapshots complex block filter like Quorum can implement the
|
||||
* following recursive callback instead of BS_IS_A_FILTER.
|
||||
/* set to true if the BlockDriver is a block filter */
|
||||
bool is_filter;
|
||||
/* for snapshots block filter like Quorum can implement the
|
||||
* following recursive callback.
|
||||
* It's purpose is to recurse on the filter children while calling
|
||||
* bdrv_recurse_is_first_non_filter on them.
|
||||
* For a sample implementation look in the future Quorum block filter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue