]> Git Repo - qemu.git/commitdiff
block: Update BlockLimits when they might have changed
authorKevin Wolf <[email protected]>
Wed, 11 Dec 2013 19:14:09 +0000 (20:14 +0100)
committerKevin Wolf <[email protected]>
Fri, 24 Jan 2014 16:40:01 +0000 (17:40 +0100)
When reopening with different flags, or when backing files disappear
from the chain, the limits may change. Make sure they get updated in
these cases.

Signed-off-by: Kevin Wolf <[email protected]>
Reviewed-by: Wenchao Xia <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Reviewed-by: BenoĆ®t Canet <[email protected]>
block.c
block/stream.c
include/block/block.h

diff --git a/block.c b/block.c
index 8a6692719a7887e37e92afcb0721a18330eaa0f4..9d0cfc46da3ca2221a10781e4c917e4b22e4b629 100644 (file)
--- a/block.c
+++ b/block.c
@@ -483,7 +483,7 @@ int bdrv_create_file(const char* filename, QEMUOptionParameter *options,
     return ret;
 }
 
-static int bdrv_refresh_limits(BlockDriverState *bs)
+int bdrv_refresh_limits(BlockDriverState *bs)
 {
     BlockDriver *drv = bs->drv;
 
@@ -1607,6 +1607,8 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state)
     reopen_state->bs->enable_write_cache = !!(reopen_state->flags &
                                               BDRV_O_CACHE_WB);
     reopen_state->bs->read_only = !(reopen_state->flags & BDRV_O_RDWR);
+
+    bdrv_refresh_limits(reopen_state->bs);
 }
 
 /*
@@ -2441,6 +2443,7 @@ int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top,
     }
     new_top_bs->backing_hd = base_bs;
 
+    bdrv_refresh_limits(new_top_bs);
 
     QSIMPLEQ_FOREACH_SAFE(intermediate_state, &states_to_delete, entry, next) {
         /* so that bdrv_close() does not recursively close the chain */
index 46bec7d37965fabe3b825944e9b3d43eceaf4775..dd0b4ac3d2918756bb4de2ba9b31996d334d63ff 100644 (file)
@@ -75,6 +75,8 @@ static void close_unused_images(BlockDriverState *top, BlockDriverState *base,
         unused->backing_hd = NULL;
         bdrv_unref(unused);
     }
+
+    bdrv_refresh_limits(top);
 }
 
 static void coroutine_fn stream_run(void *opaque)
index 59d9f12ce49e0e8761606b6fc05e2908831238d4..00a879066054ec69c73643534101b6adabda6969 100644 (file)
@@ -253,6 +253,7 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset);
 int64_t bdrv_getlength(BlockDriverState *bs);
 int64_t bdrv_get_allocated_file_size(BlockDriverState *bs);
 void bdrv_get_geometry(BlockDriverState *bs, uint64_t *nb_sectors_ptr);
+int bdrv_refresh_limits(BlockDriverState *bs);
 int bdrv_commit(BlockDriverState *bs);
 int bdrv_commit_all(void);
 int bdrv_change_backing_file(BlockDriverState *bs,
This page took 0.037328 seconds and 4 git commands to generate.