diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-09-12 19:08:31 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-09-29 14:13:39 +0200 |
commit | b85114f8cfbede8b153db68875973ef0790bf296 (patch) | |
tree | f145eb5c7d45e3e2ad8eefb5c06ac5bf72d20883 /block | |
parent | 692e01a27ccde4120f1371227d4011f668d67a76 (diff) |
block: Use 'detect-zeroes' option for 'blockdev-change-medium'
Instead of modifying the new BDS after it has been opened, use the newly
supported 'detect-zeroes' option in bdrv_open_common() so that all
requirements are checked (detect-zeroes=unmap requires discard=unmap).
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/block-backend.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index f34bad5840..639294b8e6 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1592,13 +1592,12 @@ void blk_update_root_state(BlockBackend *blk) } /* - * Applies the information in the root state to the given BlockDriverState. This - * does not include the flags which have to be specified for bdrv_open(), use - * blk_get_open_flags_from_root_state() to inquire them. + * Returns the detect-zeroes setting to be used for bdrv_open() of a + * BlockDriverState which is supposed to inherit the root state. */ -void blk_apply_root_state(BlockBackend *blk, BlockDriverState *bs) +bool blk_get_detect_zeroes_from_root_state(BlockBackend *blk) { - bs->detect_zeroes = blk->root_state.detect_zeroes; + return blk->root_state.detect_zeroes; } /* |