From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com,
wencongyang2@huawei.com, xiechanglong.d@gmail.com,
qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com,
stefanha@redhat.com, den@openvz.org, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v11 07/14] block: teach bdrv_debug_breakpoint skip filters with backing
Date: Tue, 10 Sep 2019 13:23:25 +0300 [thread overview]
Message-ID: <20190910102332.20560-8-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20190910102332.20560-1-vsementsov@virtuozzo.com>
Teach bdrv_debug_breakpoint and bdrv_debug_remove_breakpoint skip
filters with backing. This is needed to implement and use in backup job
it's own backup_top filter driver (like mirror already has one), and
without this improvement, breakpoint removal will fail at least in 55
iotest.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
---
block.c | 34 ++++++++++++++++++++++++++--------
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/block.c b/block.c
index 874a29a983..e11dd60402 100644
--- a/block.c
+++ b/block.c
@@ -5165,14 +5165,35 @@ void bdrv_debug_event(BlockDriverState *bs, BlkdebugEvent event)
bs->drv->bdrv_debug_event(bs, event);
}
-int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event,
- const char *tag)
+static BlockDriverState *bdrv_find_debug_node(BlockDriverState *bs)
{
while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) {
- bs = bs->file ? bs->file->bs : NULL;
+ if (bs->file) {
+ bs = bs->file->bs;
+ continue;
+ }
+
+ if (bs->drv->is_filter && bs->backing) {
+ bs = bs->backing->bs;
+ continue;
+ }
+
+ break;
}
if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) {
+ assert(bs->drv->bdrv_debug_remove_breakpoint);
+ return bs;
+ }
+
+ return NULL;
+}
+
+int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event,
+ const char *tag)
+{
+ bs = bdrv_find_debug_node(bs);
+ if (bs) {
return bs->drv->bdrv_debug_breakpoint(bs, event, tag);
}
@@ -5181,11 +5202,8 @@ int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event,
int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag)
{
- while (bs && bs->drv && !bs->drv->bdrv_debug_remove_breakpoint) {
- bs = bs->file ? bs->file->bs : NULL;
- }
-
- if (bs && bs->drv && bs->drv->bdrv_debug_remove_breakpoint) {
+ bs = bdrv_find_debug_node(bs);
+ if (bs) {
return bs->drv->bdrv_debug_remove_breakpoint(bs, tag);
}
--
2.18.0
next prev parent reply other threads:[~2019-09-10 10:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 10:23 [Qemu-devel] [PATCH v11 00/14] backup-top filter driver for backup Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 01/14] block/backup: fix backup_cow_with_offload for last cluster Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 02/14] block/backup: split shareable copying part from backup_do_cow Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 03/14] block/backup: improve comment about image fleecing Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 04/14] block/backup: introduce BlockCopyState Vladimir Sementsov-Ogievskiy
2019-09-13 18:25 ` Vladimir Sementsov-Ogievskiy
2019-09-20 12:46 ` Max Reitz
2019-09-20 12:56 ` Vladimir Sementsov-Ogievskiy
2019-09-20 12:56 ` Vladimir Sementsov-Ogievskiy
2019-09-20 13:26 ` Max Reitz
2019-09-20 13:32 ` Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 05/14] block/backup: fix block-comment style Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 06/14] block: move block_copy from block/backup.c to separate file Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` Vladimir Sementsov-Ogievskiy [this message]
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 08/14] iotests: prepare 124 and 257 bitmap querying for backup-top filter Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 09/14] iotests: 257: drop unused Drive.device field Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 10/14] iotests: 257: drop device_add Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 11/14] block/io: refactor wait_serialising_requests Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 12/14] block: add lock/unlock range functions Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 13/14] block: introduce backup-top filter driver Vladimir Sementsov-Ogievskiy
2019-09-10 10:23 ` [Qemu-devel] [PATCH v11 14/14] block/backup: use backup-top instead of write notifiers Vladimir Sementsov-Ogievskiy
2019-09-13 15:44 ` [Qemu-devel] [PATCH v11 00/14] backup-top filter driver for backup Vladimir Sementsov-Ogievskiy
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=20190910102332.20560-8-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=fam@euphon.net \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=wencongyang2@huawei.com \
--cc=xiechanglong.d@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).