[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v5 22/25] block: Do not copy exact_filename from for
From: |
Max Reitz |
Subject: |
[Qemu-block] [PATCH v5 22/25] block: Do not copy exact_filename from format file |
Date: |
Wed, 21 Jun 2017 14:50:44 +0200 |
If the a format BDS's file BDS is in turn a format BDS, we cannot simply
use the same filename, because when opening a BDS tree based on a
filename alone, qemu will create only one format node on top of one
protocol node (disregarding a potential backing file).
Signed-off-by: Max Reitz <address@hidden>
---
block.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index e22771b..2542ff5 100644
--- a/block.c
+++ b/block.c
@@ -4933,9 +4933,20 @@ void bdrv_refresh_filename(BlockDriverState *bs)
bs->exact_filename[0] = '\0';
- /* If no specific options have been given for this BDS, the filename of
- * the underlying file should suffice for this one as well */
- if (bs->file->bs->exact_filename[0] && !generate_json_filename) {
+ /* We can use the underlying file's filename if:
+ * - it has a filename,
+ * - the file is a protocol BDS, and
+ * - opening that file (as this BDS's format) will automatically create
+ * the BDS tree we have right now, that is:
+ * - the user did not significantly change this BDS's behavior with
+ * some explicit options
+ * - no non-file child of this BDS has been overridden by the user
+ * Both of these conditions are represented by
generate_json_filename.
+ */
+ if (bs->file->bs->exact_filename[0] &&
+ bs->file->bs->drv->bdrv_file_open &&
+ !generate_json_filename)
+ {
strcpy(bs->exact_filename, bs->file->bs->exact_filename);
}
}
--
2.9.4
- [Qemu-block] [PATCH v5 13/25] block/nbd: Make bdrv_dirname() return NULL, (continued)
- [Qemu-block] [PATCH v5 13/25] block/nbd: Make bdrv_dirname() return NULL, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 11/25] blkverify: Make bdrv_dirname() return NULL, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 12/25] quorum: Make bdrv_dirname() return NULL, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 14/25] block/nfs: Implement bdrv_dirname(), Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 15/25] block: Use bdrv_dirname() for relative filenames, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 16/25] block: Add 'base-directory' BDS option, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 17/25] iotests: Add quorum case to test 110, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 19/25] block: Add BlockDriver.bdrv_gather_child_options, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 18/25] block: Add sgfnt_runtime_opts to BlockDriver, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 20/25] block: Generically refresh runtime options, Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 22/25] block: Do not copy exact_filename from format file,
Max Reitz <=
- [Qemu-block] [PATCH v5 23/25] block: Fix FIXME from "Add BDS.backing_overridden", Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 21/25] block: Purify .bdrv_refresh_filename(), Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 24/25] block/curl: Implement bdrv_refresh_filename(), Max Reitz, 2017/06/21
- [Qemu-block] [PATCH v5 25/25] block/null: Generate filename even with latency-ns, Max Reitz, 2017/06/21