block/copy-before-write.h: global state API + assertions
copy-before-write functions always run under BQL. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20220303151616.325444-24-eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
6b573efec8
commit
377cc15bf1
@ -223,6 +223,7 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
|
|||||||
QDict *opts;
|
QDict *opts;
|
||||||
|
|
||||||
assert(source->total_sectors == target->total_sectors);
|
assert(source->total_sectors == target->total_sectors);
|
||||||
|
GLOBAL_STATE_CODE();
|
||||||
|
|
||||||
opts = qdict_new();
|
opts = qdict_new();
|
||||||
qdict_put_str(opts, "driver", "copy-before-write");
|
qdict_put_str(opts, "driver", "copy-before-write");
|
||||||
@ -245,6 +246,7 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
|
|||||||
|
|
||||||
void bdrv_cbw_drop(BlockDriverState *bs)
|
void bdrv_cbw_drop(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
|
GLOBAL_STATE_CODE();
|
||||||
bdrv_drop_filter(bs, &error_abort);
|
bdrv_drop_filter(bs, &error_abort);
|
||||||
bdrv_unref(bs);
|
bdrv_unref(bs);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,13 @@
|
|||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "block/block-copy.h"
|
#include "block/block-copy.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Global state (GS) API. These functions run under the BQL.
|
||||||
|
*
|
||||||
|
* See include/block/block-global-state.h for more information about
|
||||||
|
* the GS API.
|
||||||
|
*/
|
||||||
|
|
||||||
BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
|
BlockDriverState *bdrv_cbw_append(BlockDriverState *source,
|
||||||
BlockDriverState *target,
|
BlockDriverState *target,
|
||||||
const char *filter_node_name,
|
const char *filter_node_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user