[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 67/93] block: Update BlockLimits when they might have
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 67/93] block: Update BlockLimits when they might have changed |
Date: |
Fri, 24 Jan 2014 18:21:50 +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 <address@hidden>
Reviewed-by: Wenchao Xia <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Reviewed-by: BenoƮt Canet <address@hidden>
---
block.c | 5 ++++-
block/stream.c | 2 ++
include/block/block.h | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 8a66927..9d0cfc4 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 */
diff --git a/block/stream.c b/block/stream.c
index 46bec7d..dd0b4ac 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -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)
diff --git a/include/block/block.h b/include/block/block.h
index 59d9f12..00a8790 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -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,
--
1.8.1.4
- [Qemu-devel] [PULL 52/93] qapi: Add "backing" to BlockStats, (continued)
- [Qemu-devel] [PULL 52/93] qapi: Add "backing" to BlockStats, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 54/93] block: Allow the user to define "node-name" option both on command line and QMP., Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 53/93] block: Add bs->node_name to hold the name of a bs node of the bs graph., Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 61/93] block: resize backing file image during offline commit, if necessary, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 62/93] block: resize backing image during active layer commit, if needed, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 64/93] block: Fix bdrv_commit return value, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 63/93] block: update block commit documentation regarding image truncation, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 65/93] block: Move initialisation of BlockLimits to bdrv_refresh_limits(), Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 66/93] block: Inherit opt_transfer_length, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 68/93] qemu_memalign: Allow small alignments, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 67/93] block: Update BlockLimits when they might have changed,
Kevin Wolf <=
- [Qemu-devel] [PULL 69/93] block: Detect unaligned length in bdrv_qiov_is_aligned(), Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 70/93] block: Don't use guest sector size for qemu_blockalign(), Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 71/93] block: rename buffer_alignment to guest_block_size, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 72/93] raw: Probe required direct I/O alignment, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 76/93] block: write: Handle COR dependency after I/O throttling, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 77/93] block: Introduce bdrv_co_do_pwritev(), Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 78/93] block: Switch BdrvTrackedRequest to byte granularity, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 79/93] block: Allow waiting for overlapping requests between begin/end, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 80/93] block: Make zero-after-EOF work with larger alignment, Kevin Wolf, 2014/01/24
- [Qemu-devel] [PULL 81/93] block: Generalise and optimise COR serialisation, Kevin Wolf, 2014/01/24