mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
block: make bdrv_delete() static
Manage BlockDriverState lifecycle with refcnt, so bdrv_delete() is no longer public and should be called by bdrv_unref() if refcnt is decreased to 0. This is an identical change because effectively, there's no multiple reference of BDS now: no caller of bdrv_ref() yet, only bdrv_new() sets bs->refcnt to 1, so all bdrv_unref() now actually delete the BDS. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
9fcb025146
commit
4f6fd3491c
19 changed files with 58 additions and 58 deletions
26
qemu-img.c
26
qemu-img.c
|
@ -300,7 +300,7 @@ static BlockDriverState *bdrv_new_open(const char *filename,
|
|||
return bs;
|
||||
fail:
|
||||
if (bs) {
|
||||
bdrv_delete(bs);
|
||||
bdrv_unref(bs);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ static int img_check(int argc, char **argv)
|
|||
|
||||
fail:
|
||||
qapi_free_ImageCheck(check);
|
||||
bdrv_delete(bs);
|
||||
bdrv_unref(bs);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ static int img_commit(int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
|
||||
bdrv_delete(bs);
|
||||
bdrv_unref(bs);
|
||||
if (ret) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -1106,11 +1106,11 @@ static int img_compare(int argc, char **argv)
|
|||
ret = 0;
|
||||
|
||||
out:
|
||||
bdrv_delete(bs2);
|
||||
bdrv_unref(bs2);
|
||||
qemu_vfree(buf1);
|
||||
qemu_vfree(buf2);
|
||||
out2:
|
||||
bdrv_delete(bs1);
|
||||
bdrv_unref(bs1);
|
||||
out3:
|
||||
qemu_progress_end();
|
||||
return ret;
|
||||
|
@ -1561,12 +1561,12 @@ out:
|
|||
free_option_parameters(param);
|
||||
qemu_vfree(buf);
|
||||
if (out_bs) {
|
||||
bdrv_delete(out_bs);
|
||||
bdrv_unref(out_bs);
|
||||
}
|
||||
if (bs) {
|
||||
for (bs_i = 0; bs_i < bs_n; bs_i++) {
|
||||
if (bs[bs_i]) {
|
||||
bdrv_delete(bs[bs_i]);
|
||||
bdrv_unref(bs[bs_i]);
|
||||
}
|
||||
}
|
||||
g_free(bs);
|
||||
|
@ -1704,7 +1704,7 @@ static ImageInfoList *collect_image_info_list(const char *filename,
|
|||
*last = elem;
|
||||
last = &elem->next;
|
||||
|
||||
bdrv_delete(bs);
|
||||
bdrv_unref(bs);
|
||||
|
||||
filename = fmt = NULL;
|
||||
if (chain) {
|
||||
|
@ -1918,7 +1918,7 @@ static int img_snapshot(int argc, char **argv)
|
|||
}
|
||||
|
||||
/* Cleanup */
|
||||
bdrv_delete(bs);
|
||||
bdrv_unref(bs);
|
||||
if (ret) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -2193,14 +2193,14 @@ out:
|
|||
/* Cleanup */
|
||||
if (!unsafe) {
|
||||
if (bs_old_backing != NULL) {
|
||||
bdrv_delete(bs_old_backing);
|
||||
bdrv_unref(bs_old_backing);
|
||||
}
|
||||
if (bs_new_backing != NULL) {
|
||||
bdrv_delete(bs_new_backing);
|
||||
bdrv_unref(bs_new_backing);
|
||||
}
|
||||
}
|
||||
|
||||
bdrv_delete(bs);
|
||||
bdrv_unref(bs);
|
||||
if (ret) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -2323,7 +2323,7 @@ static int img_resize(int argc, char **argv)
|
|||
}
|
||||
out:
|
||||
if (bs) {
|
||||
bdrv_delete(bs);
|
||||
bdrv_unref(bs);
|
||||
}
|
||||
if (ret) {
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue