aboutsummaryrefslogtreecommitdiff
path: root/block/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/commit.c')
-rw-r--r--block/commit.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/block/commit.c b/block/commit.c
index 87f6096d90..7732d02dfe 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -223,7 +223,7 @@ static void bdrv_commit_top_refresh_filename(BlockDriverState *bs)
}
static void bdrv_commit_top_child_perm(BlockDriverState *bs, BdrvChild *c,
- const BdrvChildRole *role,
+ BdrvChildRole role,
BlockReopenQueue *reopen_queue,
uint64_t perm, uint64_t shared,
uint64_t *nperm, uint64_t *nshared)
@@ -240,6 +240,8 @@ static BlockDriver bdrv_commit_top = {
.bdrv_co_block_status = bdrv_co_block_status_from_backing,
.bdrv_refresh_filename = bdrv_commit_top_refresh_filename,
.bdrv_child_perm = bdrv_commit_top_child_perm,
+
+ .is_filter = true,
};
void commit_start(const char *job_id, BlockDriverState *bs,
@@ -414,7 +416,9 @@ int bdrv_commit(BlockDriverState *bs)
}
ctx = bdrv_get_aio_context(bs);
- src = blk_new(ctx, BLK_PERM_CONSISTENT_READ, BLK_PERM_ALL);
+ /* WRITE_UNCHANGED is required for bdrv_make_empty() */
+ src = blk_new(ctx, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANGED,
+ BLK_PERM_ALL);
backing = blk_new(ctx, BLK_PERM_WRITE | BLK_PERM_RESIZE, BLK_PERM_ALL);
ret = blk_insert_bs(src, bs, &local_err);
@@ -492,14 +496,14 @@ int bdrv_commit(BlockDriverState *bs)
}
}
- if (drv->bdrv_make_empty) {
- ret = drv->bdrv_make_empty(bs);
- if (ret < 0) {
- goto ro_cleanup;
- }
- blk_flush(src);
+ ret = blk_make_empty(src, NULL);
+ /* Ignore -ENOTSUP */
+ if (ret < 0 && ret != -ENOTSUP) {
+ goto ro_cleanup;
}
+ blk_flush(src);
+
/*
* Make sure all data we wrote to the backing device is actually
* stable on disk.