summaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2013-12-11 20:14:09 +0100
committerKevin Wolf <kwolf@redhat.com>2014-01-24 17:40:01 +0100
commit355ef4ac95a7a47d5c7201ccd910056a100d2fdf (patch)
tree45ebc3bfbffb57d48c82c3e3b6aa730552c338fe /block.c
parent466ad822deef3a03757d505218a52993c5d56b5d (diff)
downloadqemu-355ef4ac95a7a47d5c7201ccd910056a100d2fdf.tar.gz
block: Update BlockLimits when they might have changed
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 <kwolf@redhat.com> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: BenoƮt Canet <benoit@irqsave.net>
Diffstat (limited to 'block.c')
-rw-r--r--block.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block.c b/block.c
index 8a6692719a..9d0cfc46da 100644
--- 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 */