From: Fam Zheng <famz@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 15/16] block/mirror: Add copy mode QAPI interface
Date: Tue, 27 Feb 2018 17:38:09 +0800 [thread overview]
Message-ID: <20180227093809.GF25412@lemon.usersys.redhat.com> (raw)
In-Reply-To: <20180122220806.22154-16-mreitz@redhat.com>
On Mon, 01/22 23:08, Max Reitz wrote:
> This patch allows the user to specify whether to use active or only
> passive mode for mirror block jobs. Currently, this setting will remain
I think you want s/passive/background/ in the whole patch.
> constant for the duration of the entire block job.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> qapi/block-core.json | 11 +++++++++--
> include/block/block_int.h | 4 +++-
> block/mirror.c | 12 +++++++-----
> blockdev.c | 9 ++++++++-
> 4 files changed, 27 insertions(+), 9 deletions(-)
>
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index ba1fd736f5..5fafa5fcac 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -1573,6 +1573,9 @@
> # written. Both will result in identical contents.
> # Default is true. (Since 2.4)
> #
> +# @copy-mode: when to copy data to the destination; defaults to 'passive'
> +# (Since: 2.12)
> +#
> # Since: 1.3
> ##
> { 'struct': 'DriveMirror',
> @@ -1582,7 +1585,7 @@
> '*speed': 'int', '*granularity': 'uint32',
> '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
> '*on-target-error': 'BlockdevOnError',
> - '*unmap': 'bool' } }
> + '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode' } }
>
> ##
> # @BlockDirtyBitmap:
> @@ -1761,6 +1764,9 @@
> # above @device. If this option is not given, a node name is
> # autogenerated. (Since: 2.9)
> #
> +# @copy-mode: when to copy data to the destination; defaults to 'passive'
> +# (Since: 2.12)
> +#
> # Returns: nothing on success.
> #
> # Since: 2.6
> @@ -1781,7 +1787,8 @@
> '*speed': 'int', '*granularity': 'uint32',
> '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',
> '*on-target-error': 'BlockdevOnError',
> - '*filter-node-name': 'str' } }
> + '*filter-node-name': 'str',
> + '*copy-mode': 'MirrorCopyMode' } }
>
> ##
> # @block_set_io_throttle:
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index 03f3fdd129..1fda4d3d43 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -948,6 +948,7 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,
> * @filter_node_name: The node name that should be assigned to the filter
> * driver that the mirror job inserts into the graph above @bs. NULL means that
> * a node name should be autogenerated.
> + * @copy_mode: When to trigger writes to the target.
> * @errp: Error object.
> *
> * Start a mirroring operation on @bs. Clusters that are allocated
> @@ -961,7 +962,8 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
> MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,
> BlockdevOnError on_source_error,
> BlockdevOnError on_target_error,
> - bool unmap, const char *filter_node_name, Error **errp);
> + bool unmap, const char *filter_node_name,
> + MirrorCopyMode copy_mode, Error **errp);
>
> /*
> * backup_job_create:
> diff --git a/block/mirror.c b/block/mirror.c
> index 83082adb64..3b23886a5a 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -1409,7 +1409,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
> const BlockJobDriver *driver,
> bool is_none_mode, BlockDriverState *base,
> bool auto_complete, const char *filter_node_name,
> - bool is_mirror,
> + bool is_mirror, MirrorCopyMode copy_mode,
> Error **errp)
> {
> MirrorBlockJob *s;
> @@ -1515,7 +1515,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
> s->on_target_error = on_target_error;
> s->is_none_mode = is_none_mode;
> s->backing_mode = backing_mode;
> - s->copy_mode = MIRROR_COPY_MODE_BACKGROUND;
> + s->copy_mode = copy_mode;
> s->base = base;
> s->granularity = granularity;
> s->buf_size = ROUND_UP(buf_size, granularity);
> @@ -1582,7 +1582,8 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
> MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,
> BlockdevOnError on_source_error,
> BlockdevOnError on_target_error,
> - bool unmap, const char *filter_node_name, Error **errp)
> + bool unmap, const char *filter_node_name,
> + MirrorCopyMode copy_mode, Error **errp)
> {
> bool is_none_mode;
> BlockDriverState *base;
> @@ -1597,7 +1598,7 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
> speed, granularity, buf_size, backing_mode,
> on_source_error, on_target_error, unmap, NULL, NULL,
> &mirror_job_driver, is_none_mode, base, false,
> - filter_node_name, true, errp);
> + filter_node_name, true, copy_mode, errp);
> }
>
> void commit_active_start(const char *job_id, BlockDriverState *bs,
> @@ -1620,7 +1621,8 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,
> MIRROR_LEAVE_BACKING_CHAIN,
> on_error, on_error, true, cb, opaque,
> &commit_active_job_driver, false, base, auto_complete,
> - filter_node_name, false, &local_err);
> + filter_node_name, false, MIRROR_COPY_MODE_BACKGROUND,
I think for active commit, MIRROR_COPY_MODE_WRITE_BLOCKING is more appealing?
Can be a task for another day, though.
Fam
next prev parent reply other threads:[~2018-02-27 9:38 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 22:07 [Qemu-devel] [PATCH v2 00/16] block/mirror: Add active-sync mirroring Max Reitz
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 01/16] block: BDS deletion during bdrv_drain_recurse Max Reitz
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 02/16] block: BDS deletion in bdrv_do_drained_begin() Max Reitz
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 03/16] tests: Add bdrv-drain test for node deletion Max Reitz
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 04/16] block/mirror: Pull out mirror_perform() Max Reitz
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 05/16] block/mirror: Convert to coroutines Max Reitz
2018-02-27 7:44 ` Fam Zheng
2018-02-28 14:13 ` Max Reitz
2018-02-28 17:07 ` Max Reitz
2018-03-01 2:50 ` Fam Zheng
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 06/16] block/mirror: Use CoQueue to wait on in-flight ops Max Reitz
2018-02-27 8:37 ` Fam Zheng
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 07/16] block/mirror: Wait for in-flight op conflicts Max Reitz
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 08/16] block/mirror: Use source as a BdrvChild Max Reitz
2018-01-22 22:07 ` [Qemu-devel] [PATCH v2 09/16] block: Generalize should_update_child() rule Max Reitz
2018-01-22 22:08 ` [Qemu-devel] [PATCH v2 10/16] hbitmap: Add @advance param to hbitmap_iter_next() Max Reitz
2018-02-27 8:59 ` Fam Zheng
2018-02-28 14:28 ` Max Reitz
2018-01-22 22:08 ` [Qemu-devel] [PATCH v2 11/16] block/dirty-bitmap: Add bdrv_dirty_iter_next_area Max Reitz
2018-02-27 9:06 ` Fam Zheng
2018-02-28 14:57 ` Max Reitz
2018-01-22 22:08 ` [Qemu-devel] [PATCH v2 12/16] block/mirror: Distinguish active from passive ops Max Reitz
2018-02-27 9:12 ` Fam Zheng
2018-02-28 15:05 ` Max Reitz
2018-01-22 22:08 ` [Qemu-devel] [PATCH v2 13/16] block/mirror: Add MirrorBDSOpaque Max Reitz
2018-01-22 22:08 ` [Qemu-devel] [PATCH v2 14/16] block/mirror: Add active mirroring Max Reitz
2018-02-27 9:34 ` Fam Zheng
2018-02-27 14:25 ` Eric Blake
2018-02-28 15:06 ` Max Reitz
2018-01-22 22:08 ` [Qemu-devel] [PATCH v2 15/16] block/mirror: Add copy mode QAPI interface Max Reitz
2018-02-27 9:38 ` Fam Zheng [this message]
2018-02-28 15:55 ` Max Reitz
2018-01-22 22:08 ` [Qemu-devel] [PATCH v2 16/16] iotests: Add test for active mirroring Max Reitz
2018-02-24 15:42 ` [Qemu-devel] [PATCH v2 00/16] block/mirror: Add active-sync mirroring Max Reitz
2018-02-27 9:51 ` Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180227093809.GF25412@lemon.usersys.redhat.com \
--to=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).