aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2019-09-20 17:20:49 +0300
committerMax Reitz <mreitz@redhat.com>2019-10-10 10:56:17 +0200
commitd10529a2b7e6c44d5e4e278ca08fe4cdb357e25d (patch)
tree908d681d172e9b448fbf47e50bfa467ab55b2ebc
parentbeb5f5450d983bb4c560582efb5267813aef4065 (diff)
block: teach bdrv_debug_breakpoint skip filters with backing
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> Message-id: 20190920142056.12778-9-vsementsov@virtuozzo.com Signed-off-by: Max Reitz <mreitz@redhat.com>
-rw-r--r--block.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/block.c b/block.c
index 5944124845..1c7c199849 100644
--- a/block.c
+++ b/block.c
@@ -5164,14 +5164,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);
}
@@ -5180,11 +5201,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);
}