All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, mreitz@redhat.com, kwolf@redhat.com,
	berto@igalia.com, vsementsov@virtuozzo.com
Subject: [PATCH v5 7/9] block: BDRVReopenState: drop replace_backing_bs field
Date: Sat, 15 May 2021 16:47:03 +0300	[thread overview]
Message-ID: <20210515134705.433604-8-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210515134705.433604-1-vsementsov@virtuozzo.com>

It's used only in bdrv_reopen_commit(). "backing" is covered by the
loop through all children except for case when we removed backing child
during reopen.

Make it more obvious and drop extra boolean field: qdict_del will not
fail if there is no such entry.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 include/block/block.h |  1 -
 block.c               | 10 ++++------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/include/block/block.h b/include/block/block.h
index 82185965ff..0796f75b49 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -208,7 +208,6 @@ typedef struct BDRVReopenState {
     int flags;
     BlockdevDetectZeroesOptions detect_zeroes;
     bool backing_missing;
-    bool replace_backing_bs;  /* new_backing_bs is ignored if this is false */
     BlockDriverState *old_backing_bs; /* keep pointer for permissions update */
     QDict *options;
     QDict *explicit_options;
diff --git a/block.c b/block.c
index d90b35f8f1..819e133dfa 100644
--- a/block.c
+++ b/block.c
@@ -4271,7 +4271,6 @@ static int bdrv_reopen_parse_backing(BDRVReopenState *reopen_state,
         return -EINVAL;
     }
 
-    reopen_state->replace_backing_bs = true;
     reopen_state->old_backing_bs = bs->backing ? bs->backing->bs : NULL;
     return bdrv_set_backing_noperm(bs, new_backing_bs, set_backings_tran, errp);
 }
@@ -4526,17 +4525,16 @@ static void bdrv_reopen_commit(BDRVReopenState *reopen_state)
     bs->read_only = !(reopen_state->flags & BDRV_O_RDWR);
     bs->detect_zeroes      = reopen_state->detect_zeroes;
 
-    if (reopen_state->replace_backing_bs) {
-        qdict_del(bs->explicit_options, "backing");
-        qdict_del(bs->options, "backing");
-    }
-
     /* Remove child references from bs->options and bs->explicit_options.
      * Child options were already removed in bdrv_reopen_queue_child() */
     QLIST_FOREACH(child, &bs->children, next) {
         qdict_del(bs->explicit_options, child->name);
         qdict_del(bs->options, child->name);
     }
+    /* backing is probably removed, so it's not handled by previous loop */
+    qdict_del(bs->explicit_options, "backing");
+    qdict_del(bs->options, "backing");
+
     bdrv_refresh_limits(bs, NULL, NULL);
 }
 
-- 
2.29.2



  parent reply	other threads:[~2021-05-15 13:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 13:46 [PATCH v5 0/9] Allow changing bs->file on reopen Vladimir Sementsov-Ogievskiy
2021-05-15 13:46 ` [PATCH v5 1/9] block: introduce bdrv_remove_file_or_backing_child() Vladimir Sementsov-Ogievskiy
2021-05-15 13:46 ` [PATCH v5 2/9] block: introduce bdrv_set_file_or_backing_noperm() Vladimir Sementsov-Ogievskiy
2021-05-15 13:46 ` [PATCH v5 3/9] block: bdrv_reopen_parse_backing(): don't check aio context Vladimir Sementsov-Ogievskiy
2021-05-15 13:47 ` [PATCH v5 4/9] block: bdrv_reopen_parse_backing(): don't check frozen child Vladimir Sementsov-Ogievskiy
2021-05-15 13:47 ` [PATCH v5 5/9] block: bdrv_reopen_parse_backing(): simplify handling implicit filters Vladimir Sementsov-Ogievskiy
2021-05-15 13:47 ` [PATCH v5 6/9] block: move supports_backing check to bdrv_set_file_or_backing_noperm() Vladimir Sementsov-Ogievskiy
2021-05-15 13:47 ` Vladimir Sementsov-Ogievskiy [this message]
2021-05-15 13:47 ` [PATCH v5 8/9] block: Allow changing bs->file on reopen Vladimir Sementsov-Ogievskiy
2021-05-15 13:47 ` [PATCH v5 9/9] iotests: Test replacing files with x-blockdev-reopen Vladimir Sementsov-Ogievskiy
2021-05-15 14:20 ` [PATCH v5 0/9] Allow changing bs->file on reopen 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=20210515134705.433604-8-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=berto@igalia.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.