[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 07/45] block: document connection between child roles and bs->
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v4 07/45] block: document connection between child roles and bs->backing/bs->file |
Date: |
Tue, 29 Mar 2022 23:40:29 +0300 |
Make the informal rules formal. In further commit we'll add
corresponding assertions.
Signed-off-by: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
---
include/block/block.h | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/include/block/block.h b/include/block/block.h
index 2783f77dc2..768273b2db 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -291,6 +291,48 @@ enum {
*
* At least one of DATA, METADATA, FILTERED, or COW must be set for
* every child.
+ *
+ *
+ * = Connection with bs->children, bs->file and bs->backing fields =
+ *
+ * 1. Filters
+ *
+ * Filter drivers has drv->is_filter = true.
+ *
+ * Filter driver has exactly one FILTERED|PRIMARY child, any may have other
+ * children which must not have these bits (the example is copy-before-write
+ * filter that also has target DATA child).
+ *
+ * Filter driver never has COW children.
+ *
+ * For all filters except for mirror_top and commit_top, the filtered child is
+ * linked in bs->file, bs->backing is NULL.
+ *
+ * For mirror_top and commit_top filtered child is linked in bs->backing and
+ * their bs->file is NULL. These two filters has drv->filtered_child_is_backing
+ * = true.
+ *
+ * 2. "raw" driver (block/raw-format.c)
+ *
+ * Formally it's not a filter (drv->is_filter = false)
+ *
+ * bs->backing is always NULL
+ *
+ * Only has one child, linked in bs->file. It's role is either FILTERED|PRIMARY
+ * (like filter) either DATA|PRIMARY depending on options.
+ *
+ * 3. Other drivers
+ *
+ * Doesn't have any FILTERED children.
+ *
+ * May have at most one COW child. In this case it's linked in bs->backing.
+ * Otherwise bs->backing is NULL. COW child is never PRIMARY.
+ *
+ * May have at most one PRIMARY child. In this case it's linked in bs->file.
+ * Otherwise bs->file is NULL.
+ *
+ * May also have some other children that don't have neither PRIMARY nor COW
+ * bits set.
*/
enum BdrvChildRoleBits {
/*
--
2.35.1
- [PATCH v4 00/45] Transactional block-graph modifying API, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 01/45] block: BlockDriver: add .filtered_child_is_backing field, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 02/45] block: introduce bdrv_open_file_child() helper, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 03/45] block/blklogwrites: don't care to remove bs->file child on failure, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 04/45] test-bdrv-graph-mod: update test_parallel_perm_update test case, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 05/45] tests-bdrv-drain: bdrv_replace_test driver: declare supports_backing, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 06/45] test-bdrv-graph-mod: fix filters to be filters, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 07/45] block: document connection between child roles and bs->backing/bs->file,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v4 10/45] Revert "block: Let replace_child_tran keep indirect pointer", Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 09/45] Revert "block: Let replace_child_noperm free children", Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 08/45] block/snapshot: stress that we fallback to primary child, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 11/45] Revert "block: Restructure remove_file_or_backing_child()", Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 12/45] Revert "block: Pass BdrvChild ** to replace_child_noperm", Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 13/45] block: Manipulate bs->file / bs->backing pointers in .attach/.detach, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 14/45] block/snapshot: drop indirection around bdrv_snapshot_fallback_ptr, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 15/45] block: refactor bdrv_remove_file_or_backing_child to bdrv_remove_child, Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 16/45] block: drop bdrv_detach_child(), Vladimir Sementsov-Ogievskiy, 2022/03/29
- [PATCH v4 17/45] block: drop bdrv_remove_filter_or_cow_child, Vladimir Sementsov-Ogievskiy, 2022/03/29