qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH v2 03/25] block/block-backend.c: assertions for block-bac


From: Emanuele Giuseppe Esposito
Subject: Re: [RFC PATCH v2 03/25] block/block-backend.c: assertions for block-backend
Date: Wed, 6 Oct 2021 11:36:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1



On 05/10/2021 18:29, Eric Blake wrote:
On Tue, Oct 05, 2021 at 10:31:53AM -0400, Emanuele Giuseppe Esposito wrote:
All the global state (GS) API functions will check that
qemu_in_main_thread() returns true. If not, it means
that the safety of BQL cannot be guaranteed, and
they need to be moved to I/O.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
  block/block-backend.c  | 89 +++++++++++++++++++++++++++++++++++++++++-
  softmmu/qdev-monitor.c |  2 +
  2 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/block/block-backend.c b/block/block-backend.c
index d31ae16b99..9cd3b27b53 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -227,6 +227,7 @@ static void blk_root_activate(BdrvChild *child, Error 
**errp)
void blk_set_force_allow_inactivate(BlockBackend *blk)
  {
+    g_assert(qemu_in_main_thread());

Why g_assert()?

@@ -661,6 +676,7 @@ bool monitor_add_blk(BlockBackend *blk, const char *name, 
Error **errp)
  {
      assert(!blk->name);
      assert(name && name[0]);
+    g_assert(qemu_in_main_thread());

especially why mixed spellings?

Per osdep.h, we don't support builds with NDEBUG or G_DISABLE_ASSERT
defined to their non-default values, so behavior isn't really
different, but consistency says we use 'assert' more frequently than
'g_assert'.


You are right, I did not put that much attention to this.
Will change it in assert().

Thank you,
Emanuele




reply via email to

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