Skip to content

Commit

Permalink
block: move bdrv_can_store_new_dirty_bitmap to block/dirty-bitmap.c
Browse files Browse the repository at this point in the history
block/dirty-bitmap.c seems to be more appropriate for it and
bdrv_remove_persistent_dirty_bitmap already in it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-id: [email protected]
Signed-off-by: John Snow <[email protected]>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and jnsnow committed Oct 17, 2019
1 parent 48557b1 commit 85cc8a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
22 changes: 0 additions & 22 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -6582,25 +6582,3 @@ void bdrv_del_child(BlockDriverState *parent_bs, BdrvChild *child, Error **errp)

parent_bs->drv->bdrv_del_child(parent_bs, child, errp);
}

bool bdrv_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name,
uint32_t granularity, Error **errp)
{
BlockDriver *drv = bs->drv;

if (!drv) {
error_setg_errno(errp, ENOMEDIUM,
"Can't store persistent bitmaps to %s",
bdrv_get_device_or_node_name(bs));
return false;
}

if (!drv->bdrv_can_store_new_dirty_bitmap) {
error_setg_errno(errp, ENOTSUP,
"Can't store persistent bitmaps to %s",
bdrv_get_device_or_node_name(bs));
return false;
}

return drv->bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp);
}
22 changes: 22 additions & 0 deletions block/dirty-bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,28 @@ void bdrv_remove_persistent_dirty_bitmap(BlockDriverState *bs,
}
}

bool bdrv_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name,
uint32_t granularity, Error **errp)
{
BlockDriver *drv = bs->drv;

if (!drv) {
error_setg_errno(errp, ENOMEDIUM,
"Can't store persistent bitmaps to %s",
bdrv_get_device_or_node_name(bs));
return false;
}

if (!drv->bdrv_can_store_new_dirty_bitmap) {
error_setg_errno(errp, ENOTSUP,
"Can't store persistent bitmaps to %s",
bdrv_get_device_or_node_name(bs));
return false;
}

return drv->bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp);
}

void bdrv_disable_dirty_bitmap(BdrvDirtyBitmap *bitmap)
{
bdrv_dirty_bitmap_lock(bitmap);
Expand Down

0 comments on commit 85cc8a4

Please sign in to comment.