Lines Matching +full:- +full:- +full:root

4  * Copyright (c) 2019-2021 Virtuozzo International GmbH. All rights reserved.
23 #include "qemu/main-loop.h"
25 #include "system/block-backend.h"
28 .format_name = "pass-through",
45 .format_name = "no-perm",
61 .format_name = "exclusive-writer",
94 * +--------+
95 * | root |
96 * +--------+
101 * +--------------------+ +----------------+
102 * | passthrough filter |--------->| null-co node |
103 * +--------------------+ +----------------+
110 * +--------+
111 * | root |
112 * +--------+
117 * +--------------------+
119 * +--------------------+
124 * +----------------+
126 * +----------------+
132 BlockBackend *root = blk_new(qemu_get_aio_context(), in test_update_perm_tree() local
138 blk_insert_bs(root, bs, &error_abort); in test_update_perm_tree()
151 blk_unref(root); in test_update_perm_tree()
163 * +------+ +--------+
164 * | root | | filter |
165 * +------+ +--------+
167 * root| target|
169 * +------+ +--------+
170 * | node |<---------| target |
171 * +------+ backing +--------+
178 * +------+ +------+
179 * | root | | root |
180 * +------+ +------+
182 * root| root|
184 * +--------+ target +--------+ target
185 * | filter |--------------+ | filter |--------------+
186 * +--------+ | +--------+ |
188 * backing| | backing| | +--------+
189 * v v | +-----------| target |
190 * +------+ +--------+ v backing +--------+
191 * | node |<---------| target | +------+
192 * +------+ backing +--------+ | node |
193 * +------+
200 BlockBackend *root = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL); in test_should_update_child() local
205 blk_insert_bs(root, bs, &error_abort); in test_should_update_child()
211 g_assert(target->backing->bs == bs); in test_should_update_child()
219 g_assert(target->backing->bs == bs); in test_should_update_child()
224 blk_unref(root); in test_should_update_child()
276 * write-to-selected node may have several DATA children, one of them may be
292 BDRVWriteToSelectedState *s = bs->opaque; in write_to_selected_perms()
294 if (s->selected && c == s->selected) { in write_to_selected_perms()
304 .format_name = "write-to-selected",
311 * The following test shows that topological-sort order is required for
314 * Consider the block driver (write-to-selected) which has two children: one is
324 * │ fl2 │ ◀── │ write-to-selected │ ◀── │ top │
342 * So, we set some option for write-to-selected driver and do permission update.
345 * write-to-selected -> fl1 -> base branch it will succeed: it firstly drop
347 * But if permission update goes first through write-to-selected -> fl2 -> base
348 * branch it will fail, as when we try to update fl2->base child, old not yet
349 * updated fl1->base child will be in conflict.
351 * With topological-sort order we always update parents before children, so fl1
360 BDRVWriteToSelectedState *s = ws->opaque; in test_parallel_perm_update()
390 s->selected = c_fl1; in test_parallel_perm_update()
394 bdrv_child_refresh_perms(top, top->children.lh_first, &error_abort); in test_parallel_perm_update()
396 assert(c_fl1->perm & BLK_PERM_WRITE); in test_parallel_perm_update()
397 assert(!(c_fl2->perm & BLK_PERM_WRITE)); in test_parallel_perm_update()
400 s->selected = c_fl2; in test_parallel_perm_update()
401 bdrv_child_refresh_perms(top, top->children.lh_first, &error_abort); in test_parallel_perm_update()
403 assert(c_fl2->perm & BLK_PERM_WRITE); in test_parallel_perm_update()
404 assert(!(c_fl1->perm & BLK_PERM_WRITE)); in test_parallel_perm_update()
407 s->selected = c_fl1; in test_parallel_perm_update()
408 bdrv_child_refresh_perms(top, top->children.lh_first, &error_abort); in test_parallel_perm_update()
410 assert(c_fl1->perm & BLK_PERM_WRITE); in test_parallel_perm_update()
411 assert(!(c_fl2->perm & BLK_PERM_WRITE)); in test_parallel_perm_update()
421 * 1. [top] -> [filter] -> [base]
425 * 2. [filter] --\
427 * [top] -> [base]
461 g_test_add_func("/bdrv-graph-mod/update-perm-tree", test_update_perm_tree); in main()
462 g_test_add_func("/bdrv-graph-mod/should-update-child", in main()
464 g_test_add_func("/bdrv-graph-mod/parallel-perm-update", in main()
466 g_test_add_func("/bdrv-graph-mod/parallel-exclusive-write", in main()
468 g_test_add_func("/bdrv-graph-mod/append-greedy-filter", in main()