qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 07/33] block: Pass parent_is_format to .inherit_options()


From: Eric Blake
Subject: Re: [PATCH v2 07/33] block: Pass parent_is_format to .inherit_options()
Date: Wed, 5 Feb 2020 10:26:09 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2/4/20 11:08 AM, Max Reitz wrote:
We plan to unify the generic .inherit_options() functions.  The
resulting common function will need to decide whether to force-enable
format probing, force-disable it, or leave it as-is.  To make this
decision, it will need to know whether the parent node is a format node
or not (because we never want format probing if the parent is a format
node already (except for the backing chain)).

Signed-off-by: Max Reitz <address@hidden>
---
  block.c                   | 37 +++++++++++++++++++++++++++----------
  block/block-backend.c     |  2 +-
  block/vvfat.c             |  2 +-
  include/block/block_int.h |  2 +-
  4 files changed, 30 insertions(+), 13 deletions(-)


@@ -2992,8 +2994,22 @@ static BlockDriverState *bdrv_open_inherit(const char 
*filename,
      bs->explicit_options = qdict_clone_shallow(options);
if (child_class) {
+        bool parent_is_format;
+
+        if (parent->drv) {
+            parent_is_format = parent->drv->is_format;
+        } else {
+            /*
+             * parent->drv is not set yet because this node is opened for
+             * (potential) format probing.  That means that @parent is going
+             * to be a format node.
+             */
+            parent_is_format = true;
+        }

Nice comment.

Reviewed-by: Eric Blake <address@hidden>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




reply via email to

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