From: Kevin Wolf <kwolf@redhat.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-block@nongnu.org, vsementsov@virtuozzo.com, famz@redhat.com,
stefanha@redhat.com, jcody@redhat.com, eblake@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 02/11] blockjob: centralize QMP event emissions
Date: Wed, 5 Oct 2016 15:43:12 +0200 [thread overview]
Message-ID: <20161005134312.GA1657@noname.str.redhat.com> (raw)
In-Reply-To: <1475272849-19990-3-git-send-email-jsnow@redhat.com>
Am 01.10.2016 um 00:00 hat John Snow geschrieben:
> There's no reason to leave this to blockdev; we can do it in blockjobs
> directly and get rid of an extra callback for most users.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> blockdev.c | 37 ++++++-------------------------------
> blockjob.c | 16 ++++++++++++++--
> 2 files changed, 20 insertions(+), 33 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 29c6561..03200e7 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2957,31 +2957,6 @@ out:
> aio_context_release(aio_context);
> }
>
> -static void block_job_cb(void *opaque, int ret)
> -{
> - /* Note that this function may be executed from another AioContext besides
> - * the QEMU main loop. If you need to access anything that assumes the
> - * QEMU global mutex, use a BH or introduce a mutex.
> - */
> -
> - BlockDriverState *bs = opaque;
> - const char *msg = NULL;
> -
> - trace_block_job_cb(bs, bs->job, ret);
This trace event is removed from the code, but not from trace-events.
> -
> - assert(bs->job);
> -
> - if (ret < 0) {
> - msg = strerror(-ret);
> - }
> -
> - if (block_job_is_cancelled(bs->job)) {
> - block_job_event_cancelled(bs->job);
> - } else {
> - block_job_event_completed(bs->job, msg);
block_job_event_cancelled/completed can become static now.
> - }
> -}
> -
> void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
> bool has_base, const char *base,
> bool has_backing_file, const char *backing_file,
> @@ -3033,7 +3008,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
> base_name = has_backing_file ? backing_file : base_name;
>
> stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name,
> - has_speed ? speed : 0, on_error, block_job_cb, bs, &local_err);
> + has_speed ? speed : 0, on_error, NULL, bs, &local_err);
Passing cb == NULL, but opaque != NULL is harmless, but feels odd.
And actually this is the only caller of stream_start, so the parameters
could just be dropped.
> if (local_err) {
> error_propagate(errp, local_err);
> goto out;
> @@ -3136,10 +3111,10 @@ void qmp_block_commit(bool has_job_id, const char *job_id, const char *device,
> goto out;
> }
> commit_active_start(has_job_id ? job_id : NULL, bs, base_bs, speed,
> - on_error, block_job_cb, bs, &local_err, false);
> + on_error, NULL, bs, &local_err, false);
Here we have an additional caller in block/replication.c and qemu-img,
so the parameters must stay. For qemu-img, nothing changes. For
replication, the block job events are added as a side effect.
Not sure if we want to emit such events for an internal block job, but
if we do want the change, it should be explicit.
> } else {
> commit_start(has_job_id ? job_id : NULL, bs, base_bs, top_bs, speed,
> - on_error, block_job_cb, bs,
> + on_error, NULL, bs,
> has_backing_file ? backing_file : NULL, &local_err);
Like stream_start, drop the parameters.
> }
> if (local_err != NULL) {
> @@ -3260,7 +3235,7 @@ static void do_drive_backup(DriveBackup *backup, BlockJobTxn *txn, Error **errp)
>
> backup_start(backup->job_id, bs, target_bs, backup->speed, backup->sync,
> bmap, backup->compress, backup->on_source_error,
> - backup->on_target_error, block_job_cb, bs, txn, &local_err);
> + backup->on_target_error, NULL, bs, txn, &local_err);
> bdrv_unref(target_bs);
> if (local_err != NULL) {
> error_propagate(errp, local_err);
> @@ -3330,7 +3305,7 @@ void do_blockdev_backup(BlockdevBackup *backup, BlockJobTxn *txn, Error **errp)
> }
> backup_start(backup->job_id, bs, target_bs, backup->speed, backup->sync,
> NULL, backup->compress, backup->on_source_error,
> - backup->on_target_error, block_job_cb, bs, txn, &local_err);
> + backup->on_target_error, NULL, bs, txn, &local_err);
Backup is another job used by replication, too. Same question as above.
> if (local_err != NULL) {
> error_propagate(errp, local_err);
> }
> @@ -3410,7 +3385,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,
> has_replaces ? replaces : NULL,
> speed, granularity, buf_size, sync, backing_mode,
> on_source_error, on_target_error, unmap,
> - block_job_cb, bs, errp);
> + NULL, bs, errp);
And again, the parameters can be dropped.
Kevin
next prev parent reply other threads:[~2016-10-05 13:43 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-30 22:00 [Qemu-devel] [PATCH v2 00/11] blockjobs: Fix transactional race condition John Snow
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 01/11] blockjob: fix dead pointer in txn list John Snow
2016-10-05 13:43 ` Kevin Wolf
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 02/11] blockjob: centralize QMP event emissions John Snow
2016-10-05 13:43 ` Kevin Wolf [this message]
2016-10-05 18:49 ` John Snow
2016-10-05 19:24 ` Eric Blake
2016-10-05 21:00 ` John Snow
2016-10-10 16:45 ` Kashyap Chamarthy
2016-10-10 18:36 ` John Snow
2016-10-10 19:28 ` Eric Blake
2016-10-11 13:32 ` Kashyap Chamarthy
2016-10-06 7:44 ` Kevin Wolf
2016-10-06 16:57 ` John Snow
2016-10-06 18:16 ` Eric Blake
2016-10-06 18:19 ` John Snow
2016-10-11 9:50 ` Markus Armbruster
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 03/11] Blockjobs: Internalize user_pause logic John Snow
2016-10-04 0:57 ` Jeff Cody
2016-10-04 2:46 ` John Snow
2016-10-04 18:35 ` John Snow
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 04/11] blockjobs: Always use block_job_get_aio_context John Snow
2016-10-05 14:02 ` Kevin Wolf
2016-10-06 20:22 ` John Snow
2016-10-07 7:49 ` Paolo Bonzini
2016-10-13 0:49 ` John Snow
2016-10-13 9:03 ` Paolo Bonzini
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 05/11] blockjobs: split interface into public/private John Snow
2016-10-05 14:17 ` Kevin Wolf
2016-10-05 16:20 ` John Snow
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 06/11] blockjobs: fix documentation John Snow
2016-10-05 15:03 ` Kevin Wolf
2016-10-05 16:22 ` John Snow
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 07/11] blockjob: add .clean property John Snow
2016-10-12 11:11 ` Vladimir Sementsov-Ogievskiy
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 08/11] blockjob: add .start field John Snow
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 09/11] blockjob: add block_job_start John Snow
2016-10-05 15:17 ` Kevin Wolf
2016-10-06 22:44 ` John Snow
2016-10-17 18:00 ` John Snow
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 10/11] blockjob: refactor backup_start as backup_job_create John Snow
2016-10-07 18:39 ` John Snow
2016-10-10 8:57 ` Kevin Wolf
2016-10-10 22:51 ` John Snow
2016-10-11 8:56 ` Paolo Bonzini
2016-10-11 9:35 ` Kevin Wolf
2016-10-17 8:59 ` Fam Zheng
2016-09-30 22:00 ` [Qemu-devel] [PATCH v2 11/11] iotests: add transactional failure race test John Snow
2016-10-12 11:26 ` Vladimir Sementsov-Ogievskiy
2016-10-12 16:09 ` John Snow
2016-09-30 22:22 ` [Qemu-devel] [PATCH v2 00/11] blockjobs: Fix transactional race condition no-reply
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=20161005134312.GA1657@noname.str.redhat.com \
--to=kwolf@redhat.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=vsementsov@virtuozzo.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).