blockdev.c (96fbf5345f60a87fab8e7ea79a2406f381027db9) blockdev.c (a6b58adec28ff43c0f29ff7c95cdd5d11e87cf61)
1/*
2 * QEMU host block devices
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or
7 * later. See the COPYING file in the top-level directory.
8 *

--- 3583 unchanged lines hidden (view full) ---

3592 bool has_on_source_error,
3593 BlockdevOnError on_source_error,
3594 bool has_on_target_error,
3595 BlockdevOnError on_target_error,
3596 bool has_unmap, bool unmap,
3597 bool has_filter_node_name,
3598 const char *filter_node_name,
3599 bool has_copy_mode, MirrorCopyMode copy_mode,
1/*
2 * QEMU host block devices
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or
7 * later. See the COPYING file in the top-level directory.
8 *

--- 3583 unchanged lines hidden (view full) ---

3592 bool has_on_source_error,
3593 BlockdevOnError on_source_error,
3594 bool has_on_target_error,
3595 BlockdevOnError on_target_error,
3596 bool has_unmap, bool unmap,
3597 bool has_filter_node_name,
3598 const char *filter_node_name,
3599 bool has_copy_mode, MirrorCopyMode copy_mode,
3600 bool has_auto_finalize, bool auto_finalize,
3601 bool has_auto_dismiss, bool auto_dismiss,
3600 Error **errp)
3601{
3602 int job_flags = JOB_DEFAULT;
3603
3604 if (!has_speed) {
3605 speed = 0;
3606 }
3607 if (!has_on_source_error) {

--- 12 unchanged lines hidden (view full) ---

3620 unmap = true;
3621 }
3622 if (!has_filter_node_name) {
3623 filter_node_name = NULL;
3624 }
3625 if (!has_copy_mode) {
3626 copy_mode = MIRROR_COPY_MODE_BACKGROUND;
3627 }
3602 Error **errp)
3603{
3604 int job_flags = JOB_DEFAULT;
3605
3606 if (!has_speed) {
3607 speed = 0;
3608 }
3609 if (!has_on_source_error) {

--- 12 unchanged lines hidden (view full) ---

3622 unmap = true;
3623 }
3624 if (!has_filter_node_name) {
3625 filter_node_name = NULL;
3626 }
3627 if (!has_copy_mode) {
3628 copy_mode = MIRROR_COPY_MODE_BACKGROUND;
3629 }
3630 if (has_auto_finalize && !auto_finalize) {
3631 job_flags |= JOB_MANUAL_FINALIZE;
3632 }
3633 if (has_auto_dismiss && !auto_dismiss) {
3634 job_flags |= JOB_MANUAL_DISMISS;
3635 }
3628
3629 if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
3630 error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
3631 "a value in range [512B, 64MB]");
3632 return;
3633 }
3634 if (granularity & (granularity - 1)) {
3635 error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",

--- 161 unchanged lines hidden (view full) ---

3797 backing_mode, arg->has_speed, arg->speed,
3798 arg->has_granularity, arg->granularity,
3799 arg->has_buf_size, arg->buf_size,
3800 arg->has_on_source_error, arg->on_source_error,
3801 arg->has_on_target_error, arg->on_target_error,
3802 arg->has_unmap, arg->unmap,
3803 false, NULL,
3804 arg->has_copy_mode, arg->copy_mode,
3636
3637 if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
3638 error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
3639 "a value in range [512B, 64MB]");
3640 return;
3641 }
3642 if (granularity & (granularity - 1)) {
3643 error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",

--- 161 unchanged lines hidden (view full) ---

3805 backing_mode, arg->has_speed, arg->speed,
3806 arg->has_granularity, arg->granularity,
3807 arg->has_buf_size, arg->buf_size,
3808 arg->has_on_source_error, arg->on_source_error,
3809 arg->has_on_target_error, arg->on_target_error,
3810 arg->has_unmap, arg->unmap,
3811 false, NULL,
3812 arg->has_copy_mode, arg->copy_mode,
3813 arg->has_auto_finalize, arg->auto_finalize,
3814 arg->has_auto_dismiss, arg->auto_dismiss,
3805 &local_err);
3806 bdrv_unref(target_bs);
3807 error_propagate(errp, local_err);
3808out:
3809 aio_context_release(aio_context);
3810}
3811
3812void qmp_blockdev_mirror(bool has_job_id, const char *job_id,

--- 5 unchanged lines hidden (view full) ---

3818 bool has_buf_size, int64_t buf_size,
3819 bool has_on_source_error,
3820 BlockdevOnError on_source_error,
3821 bool has_on_target_error,
3822 BlockdevOnError on_target_error,
3823 bool has_filter_node_name,
3824 const char *filter_node_name,
3825 bool has_copy_mode, MirrorCopyMode copy_mode,
3815 &local_err);
3816 bdrv_unref(target_bs);
3817 error_propagate(errp, local_err);
3818out:
3819 aio_context_release(aio_context);
3820}
3821
3822void qmp_blockdev_mirror(bool has_job_id, const char *job_id,

--- 5 unchanged lines hidden (view full) ---

3828 bool has_buf_size, int64_t buf_size,
3829 bool has_on_source_error,
3830 BlockdevOnError on_source_error,
3831 bool has_on_target_error,
3832 BlockdevOnError on_target_error,
3833 bool has_filter_node_name,
3834 const char *filter_node_name,
3835 bool has_copy_mode, MirrorCopyMode copy_mode,
3836 bool has_auto_finalize, bool auto_finalize,
3837 bool has_auto_dismiss, bool auto_dismiss,
3826 Error **errp)
3827{
3828 BlockDriverState *bs;
3829 BlockDriverState *target_bs;
3830 AioContext *aio_context;
3831 BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN;
3832 Error *local_err = NULL;
3833

--- 17 unchanged lines hidden (view full) ---

3851 has_speed, speed,
3852 has_granularity, granularity,
3853 has_buf_size, buf_size,
3854 has_on_source_error, on_source_error,
3855 has_on_target_error, on_target_error,
3856 true, true,
3857 has_filter_node_name, filter_node_name,
3858 has_copy_mode, copy_mode,
3838 Error **errp)
3839{
3840 BlockDriverState *bs;
3841 BlockDriverState *target_bs;
3842 AioContext *aio_context;
3843 BlockMirrorBackingMode backing_mode = MIRROR_LEAVE_BACKING_CHAIN;
3844 Error *local_err = NULL;
3845

--- 17 unchanged lines hidden (view full) ---

3863 has_speed, speed,
3864 has_granularity, granularity,
3865 has_buf_size, buf_size,
3866 has_on_source_error, on_source_error,
3867 has_on_target_error, on_target_error,
3868 true, true,
3869 has_filter_node_name, filter_node_name,
3870 has_copy_mode, copy_mode,
3871 has_auto_finalize, auto_finalize,
3872 has_auto_dismiss, auto_dismiss,
3859 &local_err);
3860 error_propagate(errp, local_err);
3861
3862 aio_context_release(aio_context);
3863}
3864
3865/* Get a block job using its ID and acquire its AioContext */
3866static BlockJob *find_block_job(const char *id, AioContext **aio_context,

--- 563 unchanged lines hidden ---
3873 &local_err);
3874 error_propagate(errp, local_err);
3875
3876 aio_context_release(aio_context);
3877}
3878
3879/* Get a block job using its ID and acquire its AioContext */
3880static BlockJob *find_block_job(const char *id, AioContext **aio_context,

--- 563 unchanged lines hidden ---