[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v9 3/7] block: make bdrv_find_child() function public
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v9 3/7] block: make bdrv_find_child() function public |
Date: |
Wed, 26 Jun 2024 14:53:46 +0300 |
To be reused soon for blockdev-replace functionality.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
block.c | 13 +++++++++++++
blockdev.c | 14 --------------
include/block/block_int-io.h | 2 ++
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/block.c b/block.c
index 468cf5e67d..f6292f459a 100644
--- a/block.c
+++ b/block.c
@@ -8174,6 +8174,19 @@ int bdrv_make_empty(BdrvChild *c, Error **errp)
return 0;
}
+BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, const char *child_name)
+{
+ BdrvChild *child;
+
+ QLIST_FOREACH(child, &parent_bs->children, next) {
+ if (strcmp(child->name, child_name) == 0) {
+ return child;
+ }
+ }
+
+ return NULL;
+}
+
/*
* Return the child that @bs acts as an overlay for, and from which data may be
* copied in COW or COR operations. Usually this is the backing file.
diff --git a/blockdev.c b/blockdev.c
index 835064ed03..ba7e90b06e 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3452,20 +3452,6 @@ void qmp_blockdev_del(const char *node_name, Error
**errp)
bdrv_unref(bs);
}
-static BdrvChild * GRAPH_RDLOCK
-bdrv_find_child(BlockDriverState *parent_bs, const char *child_name)
-{
- BdrvChild *child;
-
- QLIST_FOREACH(child, &parent_bs->children, next) {
- if (strcmp(child->name, child_name) == 0) {
- return child;
- }
- }
-
- return NULL;
-}
-
void qmp_x_blockdev_change(const char *parent, const char *child,
const char *node, Error **errp)
{
diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h
index 4a7cf2b4fd..11ed4aa927 100644
--- a/include/block/block_int-io.h
+++ b/include/block/block_int-io.h
@@ -130,6 +130,8 @@ bdrv_co_refresh_total_sectors(BlockDriverState *bs, int64_t
hint);
int co_wrapper_mixed_bdrv_rdlock
bdrv_refresh_total_sectors(BlockDriverState *bs, int64_t hint);
+BdrvChild * GRAPH_RDLOCK
+bdrv_find_child(BlockDriverState *parent_bs, const char *child_name);
BdrvChild * GRAPH_RDLOCK bdrv_cow_child(BlockDriverState *bs);
BdrvChild * GRAPH_RDLOCK bdrv_filter_child(BlockDriverState *bs);
BdrvChild * GRAPH_RDLOCK bdrv_filter_or_cow_child(BlockDriverState *bs);
--
2.34.1
- [PATCH v9 0/7] blockdev-replace, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 2/7] block/export: add blk_by_export_id(), Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 6/7] iotests.py: introduce VM.assert_edges_list() method, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 1/7] block-backend: blk_root(): drop const specifier on return type, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 3/7] block: make bdrv_find_child() function public,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v9 7/7] iotests: add filter-insertion, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 4/7] qapi: add blockdev-replace command, Vladimir Sementsov-Ogievskiy, 2024/06/26
- [PATCH v9 5/7] block: bdrv_get_xdbg_block_graph(): report export ids, Vladimir Sementsov-Ogievskiy, 2024/06/26