[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/24] block: BDRVReopenState: drop replace_backing_bs field
From: |
Kevin Wolf |
Subject: |
[PULL 12/24] block: BDRVReopenState: drop replace_backing_bs field |
Date: |
Wed, 30 Jun 2021 18:01:54 +0200 |
From: Vladimir Sementsov-Ogievskiy <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>
Message-Id: <20210610120537.196183-8-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.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 8e707a83b7..d28022e761 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 0a73335380..ca11078cd2 100644
--- a/block.c
+++ b/block.c
@@ -4296,7 +4296,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);
}
@@ -4550,17 +4549,16 @@ static void bdrv_reopen_commit(BDRVReopenState
*reopen_state)
bs->open_flags = reopen_state->flags;
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.31.1
- [PULL 00/24] Block layer patches, Kevin Wolf, 2021/06/30
- [PULL 01/24] Prevent compiler warning on block.c, Kevin Wolf, 2021/06/30
- [PULL 03/24] block: BDRV_O_NO_IO for backing file on creation, Kevin Wolf, 2021/06/30
- [PULL 02/24] block: Move read-only check during truncation earlier, Kevin Wolf, 2021/06/30
- [PULL 06/24] block: introduce bdrv_remove_file_or_backing_child(), Kevin Wolf, 2021/06/30
- [PULL 08/24] block: bdrv_reopen_parse_backing(): don't check aio context, Kevin Wolf, 2021/06/30
- [PULL 07/24] block: introduce bdrv_set_file_or_backing_noperm(), Kevin Wolf, 2021/06/30
- [PULL 12/24] block: BDRVReopenState: drop replace_backing_bs field,
Kevin Wolf <=
- [PULL 09/24] block: bdrv_reopen_parse_backing(): don't check frozen child, Kevin Wolf, 2021/06/30
- [PULL 10/24] block: bdrv_reopen_parse_backing(): simplify handling implicit filters, Kevin Wolf, 2021/06/30
- [PULL 11/24] block: move supports_backing check to bdrv_set_file_or_backing_noperm(), Kevin Wolf, 2021/06/30
- [PULL 13/24] block: Allow changing bs->file on reopen, Kevin Wolf, 2021/06/30
- [PULL 04/24] block: rename bdrv_replace_child to bdrv_replace_child_tran, Kevin Wolf, 2021/06/30
- [PULL 17/24] block/ssh: add support for sha256 host key fingerprints, Kevin Wolf, 2021/06/30
- [PULL 15/24] introduce QEMU_AUTO_VFREE, Kevin Wolf, 2021/06/30
- [PULL 18/24] vhost: Add Error parameter to vhost_dev_init(), Kevin Wolf, 2021/06/30
- [PULL 16/24] block/commit: use QEMU_AUTO_VFREE, Kevin Wolf, 2021/06/30
- [PULL 22/24] vhost: Distinguish errors in vhost_dev_get_config(), Kevin Wolf, 2021/06/30