Skip to contentSkip to conversation

Block migration fail, ignore error from bdrv_getlength

PATCH Applied Shahar Havivi 2 participants 2 messages Jul 10, 2010 – Jul 12, 2010

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Block migration fail, ignore error from bdrv_getlength

When there is no block driver associate with BlockDriverState bdrv_getlength returns -ENOMEDIUM that cause block migration to fail

v2:
fix sectors<0 to sectors<=0

---
 block-migration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block-migration.c +1 -1
index 7db6f02..a77106e 100644
@@ -238,7 +238,7 @@ static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
 
     if (!bdrv_is_read_only(bs)) {
         sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
-        if (sectors == 0) {
+        if (sectors <= 0) {
             return;
         }
 
Signature · 1 line
1.7.1.1
Applied
#1 lore raw

Am 10.07.2010 17:59, schrieb Shahar Havivi:

Quoted 5 lines

When there is no block driver associate with BlockDriverState bdrv_getlength returns -ENOMEDIUM that cause block migration to fail

v2:
fix sectors<0 to sectors<=0

Please put the changes between patch versions below the --- line so that git am ignores it.

Quoted 11 lines
---
 block-migration.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
block-migration.c +0 -0
index 7db6f02..a77106e 100644

block-migration.c static void init_blk_migration_it(void *opaque, BlockDriverState *bs) · line 244

Quoted 8 lines
block-migration.c +1 -1
@@ -238,7 +238,7 @@ static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
 
     if (!bdrv_is_read_only(bs)) {
         sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
-        if (sectors == 0) {
+        if (sectors <= 0) {
             return;
         }
 

Dealing with -errno shifted by 9 looks really strange, but it should be correct (sectors being -1 for error cases in practice).

Thanks, applied to the block branch.

Kevin