]> xenbits.xensource.com Git - people/pauldu/qemu.git/commitdiff
block: Use children list in bdrv_refresh_filename
authorMax Reitz <mreitz@redhat.com>
Fri, 1 Feb 2019 19:29:06 +0000 (20:29 +0100)
committerMax Reitz <mreitz@redhat.com>
Mon, 25 Feb 2019 14:11:25 +0000 (15:11 +0100)
bdrv_refresh_filename() should invoke itself recursively on all
children, not just on file.

With that change, we can remove the manual invocations in blkverify,
quorum, commit, mirror, and blklogwrites.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Message-id: 20190201192935.18394-3-mreitz@redhat.com
Signed-off-by: Max Reitz <mreitz@redhat.com>
block.c
block/blklogwrites.c
block/blkverify.c
block/commit.c
block/mirror.c
block/quorum.c

diff --git a/block.c b/block.c
index 88aa687a6808ac3f1caa036e6feef112556cf1ae..d97f5e708480b70b994b81f82696f27888e2aaca 100644 (file)
--- a/block.c
+++ b/block.c
@@ -5536,16 +5536,17 @@ static bool append_open_options(QDict *d, BlockDriverState *bs)
 void bdrv_refresh_filename(BlockDriverState *bs)
 {
     BlockDriver *drv = bs->drv;
+    BdrvChild *child;
     QDict *opts;
 
     if (!drv) {
         return;
     }
 
-    /* This BDS's file name will most probably depend on its file's name, so
-     * refresh that first */
-    if (bs->file) {
-        bdrv_refresh_filename(bs->file->bs);
+    /* This BDS's file name may depend on any of its children's file names, so
+     * refresh those first */
+    QLIST_FOREACH(child, &bs->children, next) {
+        bdrv_refresh_filename(child->bs);
     }
 
     if (drv->bdrv_refresh_filename) {
index d2e01bdb1d0cf392d704672ef519881225da4783..36e3d0f822b60b2365d1be01fced39966ca63ff4 100644 (file)
@@ -285,9 +285,6 @@ static void blk_log_writes_refresh_filename(BlockDriverState *bs,
 {
     BDRVBlkLogWritesState *s = bs->opaque;
 
-    /* bs->file->bs has already been refreshed */
-    bdrv_refresh_filename(s->log_file->bs);
-
     if (bs->file->bs->full_open_options
         && s->log_file->bs->full_open_options)
     {
index 89bf4386e32eee170a42999beaf5d20d8c9118ee..035d77b64a51628d868b1dedf1fba00e6d80d79f 100644 (file)
@@ -285,9 +285,6 @@ static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options)
 {
     BDRVBlkverifyState *s = bs->opaque;
 
-    /* bs->file->bs has already been refreshed */
-    bdrv_refresh_filename(s->test_file->bs);
-
     if (bs->file->bs->full_open_options
         && s->test_file->bs->full_open_options)
     {
index 5deb05925b4e5e3fa896ac59a0ce5f24c6fdc02a..614a8ca374f08c68dcd256fd4acb415a425a55ed 100644 (file)
@@ -232,7 +232,6 @@ static int coroutine_fn bdrv_commit_top_preadv(BlockDriverState *bs,
 
 static void bdrv_commit_top_refresh_filename(BlockDriverState *bs, QDict *opts)
 {
-    bdrv_refresh_filename(bs->backing->bs);
     pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
             bs->backing->bs->filename);
 }
index b67b0120f800c3e12e723ec828dacd3767de1959..031c1aeaebdf6ba1ad21bb83a6eebc12c31b15b8 100644 (file)
@@ -1438,7 +1438,6 @@ static void bdrv_mirror_top_refresh_filename(BlockDriverState *bs, QDict *opts)
          * bdrv_set_backing_hd */
         return;
     }
-    bdrv_refresh_filename(bs->backing->bs);
     pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
             bs->backing->bs->filename);
 }
index 16b3c8067c8c655ecb770364ece989809b2839e8..cf9d7c16c21dfc96f463c0384a9d1ff7816b8f64 100644 (file)
@@ -1073,7 +1073,6 @@ static void quorum_refresh_filename(BlockDriverState *bs, QDict *options)
     int i;
 
     for (i = 0; i < s->num_children; i++) {
-        bdrv_refresh_filename(s->children[i]->bs);
         if (!s->children[i]->bs->full_open_options) {
             return;
         }