mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
block: bdrv_append(): don't consume reference
We have too much comments for this feature. It seems better just don't do it. Most of real users (tests don't count) have to create additional reference. Drop also comment in external_snapshot_prepare: - bdrv_append doesn't "remove" old bs in common sense, it sounds strange - the fact that bdrv_append can fail is obvious from the context - the fact that we must rollback all changes in transaction abort is known (it's the direct role of abort) Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20210428151804.439460-5-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
397f7cc0c2
commit
ae9d441706
7 changed files with 8 additions and 31 deletions
|
@ -1478,7 +1478,6 @@ static void test_append_to_drained(void)
|
|||
g_assert_cmpint(base_s->drain_count, ==, 1);
|
||||
g_assert_cmpint(base->in_flight, ==, 0);
|
||||
|
||||
/* Takes ownership of overlay, so we don't have to unref it later */
|
||||
bdrv_append(overlay, base, &error_abort);
|
||||
g_assert_cmpint(base->in_flight, ==, 0);
|
||||
g_assert_cmpint(overlay->in_flight, ==, 0);
|
||||
|
@ -1495,6 +1494,7 @@ static void test_append_to_drained(void)
|
|||
g_assert_cmpint(overlay->quiesce_counter, ==, 0);
|
||||
g_assert_cmpint(overlay_s->drain_count, ==, 0);
|
||||
|
||||
bdrv_unref(overlay);
|
||||
bdrv_unref(base);
|
||||
blk_unref(blk);
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ static void test_update_perm_tree(void)
|
|||
ret = bdrv_append(filter, bs, NULL);
|
||||
g_assert_cmpint(ret, <, 0);
|
||||
|
||||
bdrv_unref(filter);
|
||||
blk_unref(root);
|
||||
}
|
||||
|
||||
|
@ -202,6 +203,7 @@ static void test_should_update_child(void)
|
|||
bdrv_append(filter, bs, &error_abort);
|
||||
g_assert(target->backing->bs == bs);
|
||||
|
||||
bdrv_unref(filter);
|
||||
bdrv_unref(bs);
|
||||
blk_unref(root);
|
||||
}
|
||||
|
@ -380,6 +382,7 @@ static void test_append_greedy_filter(void)
|
|||
&error_abort);
|
||||
|
||||
bdrv_append(fl, base, &error_abort);
|
||||
bdrv_unref(fl);
|
||||
bdrv_unref(top);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue