qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v2 16/25] block/backup-top.h: global state API + assertio


From: Paolo Bonzini
Subject: Re: [RFC PATCH v2 16/25] block/backup-top.h: global state API + assertions
Date: Thu, 7 Oct 2021 14:08:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

On 05/10/21 16:32, Emanuele Giuseppe Esposito wrote:
backup-top functions always run under BQL lock.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
  block/backup-top.c |  2 ++
  block/backup-top.h | 11 +++++++++++
  2 files changed, 13 insertions(+)

diff --git a/block/backup-top.c b/block/backup-top.c
index 425e3778be..8b58a909f7 100644
--- a/block/backup-top.c
+++ b/block/backup-top.c
@@ -182,6 +182,7 @@ BlockDriverState *bdrv_backup_top_append(BlockDriverState 
*source,
      bool appended = false;
assert(source->total_sectors == target->total_sectors);
+    g_assert(qemu_in_main_thread());
top = bdrv_new_open_driver(&bdrv_backup_top_filter, filter_node_name,
                                 BDRV_O_RDWR, errp);
@@ -244,6 +245,7 @@ fail:
  void bdrv_backup_top_drop(BlockDriverState *bs)
  {
      BDRVBackupTopState *s = bs->opaque;
+    g_assert(qemu_in_main_thread());
bdrv_drop_filter(bs, &error_abort); diff --git a/block/backup-top.h b/block/backup-top.h
index b28b0031c4..8cb6f62869 100644
--- a/block/backup-top.h
+++ b/block/backup-top.h
@@ -29,6 +29,17 @@
  #include "block/block_int.h"
  #include "block/block-copy.h"
+/*
+ * Graph API. These functions run under the BQL lock.
+ *
+ * If a function modifies the graph, it uses drain and/or
+ * aio_context_acquire/release to be sure it has unique access.
+ *
+ * All functions in this header must use this assertion:
+ * g_assert(qemu_in_main_thread());
+ * to be sure they belong here.
+ */
+
  BlockDriverState *bdrv_backup_top_append(BlockDriverState *source,
                                           BlockDriverState *target,
                                           const char *filter_node_name,


This is now bdrv_cbw_append, but anyway:

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]