qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for 9.0] migration: Skip only empty block devices
@ 2024-03-12 12:04 Cédric Le Goater
  2024-03-12 12:15 ` Cédric Le Goater
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Cédric Le Goater @ 2024-03-12 12:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-block, Peter Xu, Fabiano Rosas, Stefan Hajnoczi,
	Cédric Le Goater, Markus Armbruster

The block .save_setup() handler calls a helper routine
init_blk_migration() which builds a list of block devices to take into
account for migration. When one device is found to be empty (sectors
== 0), the loop exits and all the remaining devices are ignored. This
is a regression introduced when bdrv_iterate() was removed.

Change that by skipping only empty devices.

Cc: Markus Armbruster <armbru@redhat.com>
Suggested: Kevin Wolf <kwolf@redhat.com>
Fixes: fea68bb6e9fa ("block: Eliminate bdrv_iterate(), use bdrv_next()")
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 migration/block.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/migration/block.c b/migration/block.c
index 8c6ebafacc1ffe930d1d4f19d968817b14852c69..2b9054889ad2ba739828594c50cf047703757e96 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -402,7 +402,10 @@ static int init_blk_migration(QEMUFile *f)
         }
 
         sectors = bdrv_nb_sectors(bs);
-        if (sectors <= 0) {
+        if (sectors == 0) {
+            continue;
+        }
+        if (sectors < 0) {
             ret = sectors;
             bdrv_next_cleanup(&it);
             goto out;
-- 
2.44.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-13  9:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-12 12:04 [PATCH for 9.0] migration: Skip only empty block devices Cédric Le Goater
2024-03-12 12:15 ` Cédric Le Goater
2024-03-12 12:27 ` Peter Xu
2024-03-13  9:57   ` Kevin Wolf
2024-03-12 18:41 ` Stefan Hajnoczi
2024-03-12 20:22   ` Cédric Le Goater
2024-03-12 21:34     ` Stefan Hajnoczi
2024-03-12 22:11       ` Peter Xu
2024-03-13  7:11         ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).