[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 22/26] block: Do not copy exact_filename from for
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PATCH v8 22/26] block: Do not copy exact_filename from format file |
Date: |
Mon, 5 Feb 2018 16:18:31 +0100 |
If 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>
Reviewed-by: Alberto Garcia <address@hidden>
---
block.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/block.c b/block.c
index 2963cbc921..664f87bad4 100644
--- a/block.c
+++ b/block.c
@@ -5159,9 +5159,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.14.3
- [Qemu-devel] [PATCH v8 18/26] block: Add sgfnt_runtime_opts to BlockDriver, (continued)
[Qemu-devel] [PATCH v8 24/26] block/curl: Harmonize option defaults, Max Reitz, 2018/02/05
[Qemu-devel] [PATCH v8 23/26] block: Fix FIXME from "Add BDS.backing_overridden", Max Reitz, 2018/02/05
[Qemu-devel] [PATCH v8 22/26] block: Do not copy exact_filename from format file,
Max Reitz <=
[Qemu-devel] [PATCH v8 25/26] block/curl: Implement bdrv_refresh_filename(), Max Reitz, 2018/02/05
[Qemu-devel] [PATCH v8 26/26] block/null: Generate filename even with latency-ns, Max Reitz, 2018/02/05