diff options
author | Kevin Wolf <kwolf@redhat.com> | 2013-12-11 19:26:16 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-01-24 17:40:01 +0100 |
commit | d34682cd4a06efe9ee3fc8cb7e8a0ea445299989 (patch) | |
tree | ff1e3ffdb4f56ff7e2c3d86542a711d731622c4b /block/qed.c | |
parent | dabfa6cc2e2a06269026fcb42772894f67bd0c3e (diff) | |
download | qemu-d34682cd4a06efe9ee3fc8cb7e8a0ea445299989.zip qemu-d34682cd4a06efe9ee3fc8cb7e8a0ea445299989.tar.gz qemu-d34682cd4a06efe9ee3fc8cb7e8a0ea445299989.tar.bz2 |
block: Move initialisation of BlockLimits to bdrv_refresh_limits()
This function separates filling the BlockLimits from bdrv_open(), which
allows it to call it from other operations which may change the limits
(e.g. modifications to the backing file chain or bdrv_reopen)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Diffstat (limited to 'block/qed.c')
-rw-r--r-- | block/qed.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/block/qed.c b/block/qed.c index 0dd5c58..694e6e2 100644 --- a/block/qed.c +++ b/block/qed.c @@ -495,7 +495,6 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags, } } - bs->bl.write_zeroes_alignment = s->header.cluster_size >> BDRV_SECTOR_BITS; s->need_check_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, qed_need_check_timer_cb, s); @@ -507,6 +506,15 @@ out: return ret; } +static int bdrv_qed_refresh_limits(BlockDriverState *bs) +{ + BDRVQEDState *s = bs->opaque; + + bs->bl.write_zeroes_alignment = s->header.cluster_size >> BDRV_SECTOR_BITS; + + return 0; +} + /* We have nothing to do for QED reopen, stubs just return * success */ static int bdrv_qed_reopen_prepare(BDRVReopenState *state, @@ -1616,6 +1624,7 @@ static BlockDriver bdrv_qed = { .bdrv_truncate = bdrv_qed_truncate, .bdrv_getlength = bdrv_qed_getlength, .bdrv_get_info = bdrv_qed_get_info, + .bdrv_refresh_limits = bdrv_qed_refresh_limits, .bdrv_change_backing_file = bdrv_qed_change_backing_file, .bdrv_invalidate_cache = bdrv_qed_invalidate_cache, .bdrv_check = bdrv_qed_check, |