From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, richard.henderson@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 7/8] block: add bdrv_child_notify_resize() to notify a single parent
Date: Tue, 17 Nov 2026 18:17:57 +0100 [thread overview]
Message-ID: <20261117171758.237462-8-kwolf@redhat.com> (raw)
In-Reply-To: <20261117171758.237462-1-kwolf@redhat.com>
From: "Denis V. Lunev" <den@openvz.org>
bdrv_co_parent_cb_resize() calls the resize hook of every parent of a
node. bdrv_replace_child_bs() needs to call it for one BdrvChild, and
from outside a coroutine.
Move the call into bdrv_co_child_notify_resize(), make the loop use it,
and add a co_wrapper for callers outside a coroutine.
No functional change.
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: Eric Blake <eblake@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261105203752.3169635-3-den@openvz.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block_int-io.h | 9 +++++++++
block/io.c | 14 +++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h
index 95d0dd7a05f..3cb72fecd4f 100644
--- a/include/block/block_int-io.h
+++ b/include/block/block_int-io.h
@@ -197,6 +197,15 @@ void bdrv_bsc_fill(BlockDriverState *bs, int64_t offset, int64_t bytes);
void coroutine_fn GRAPH_RDLOCK
bdrv_co_parent_cb_resize(BlockDriverState *bs);
+/*
+ * Notify the parent behind @c that the size of its child changed.
+ */
+void coroutine_fn GRAPH_RDLOCK
+bdrv_co_child_notify_resize(BdrvChild *c);
+
+void co_wrapper_bdrv_rdlock
+bdrv_child_notify_resize(BdrvChild *c);
+
void co_wrapper_bdrv_rdlock
bdrv_parent_cb_resize(BlockDriverState *bs);
diff --git a/block/io.c b/block/io.c
index 0f81b7e6bb9..e4568d4d244 100644
--- a/block/io.c
+++ b/block/io.c
@@ -3636,6 +3636,16 @@ int coroutine_fn bdrv_co_copy_range(BdrvChild *src, int64_t src_offset,
bytes, read_flags, write_flags);
}
+void coroutine_fn bdrv_co_child_notify_resize(BdrvChild *c)
+{
+ IO_CODE();
+ assert_bdrv_graph_readable();
+
+ if (c->klass->resize) {
+ c->klass->resize(c);
+ }
+}
+
void coroutine_fn bdrv_co_parent_cb_resize(BlockDriverState *bs)
{
BdrvChild *c;
@@ -3644,9 +3654,7 @@ void coroutine_fn bdrv_co_parent_cb_resize(BlockDriverState *bs)
assert_bdrv_graph_readable();
QLIST_FOREACH(c, &bs->parents, next_parent) {
- if (c->klass->resize) {
- c->klass->resize(c);
- }
+ bdrv_co_child_notify_resize(c);
}
}
--
2.56.1
next prev parent reply other threads:[~2026-11-17 17:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 17:17 [PULL 0/8] Block layer patches Kevin Wolf
2026-11-17 17:17 ` [PULL 1/8] block/bochs: validate bitmap size and compute extent_blocks after validation Kevin Wolf
2026-11-17 17:17 ` [PULL 2/8] iotests: better heuristics to find I/O tests build/source dirs Kevin Wolf
2026-11-17 20:06 ` Richard Henderson
2026-11-17 20:50 ` Kevin Wolf
2026-11-17 17:17 ` [PULL 3/8] block/vhdx-log: Improve sanity checks to avoid OOB accesses with bad images Kevin Wolf
2026-11-17 17:17 ` [PULL 4/8] iotests: fix false positive on running-outside-venv warning Kevin Wolf
2026-11-17 17:17 ` [PULL 5/8] block/vhdx: Add alignment checks for region tables Kevin Wolf
2026-11-17 17:17 ` [PULL 6/8] block: read the old child length after draining in bdrv_replace_child_bs() Kevin Wolf
2026-11-17 17:17 ` Kevin Wolf [this message]
2026-11-17 17:17 ` [PULL 8/8] block: notify only the replaced child " Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261117171758.237462-8-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.