From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063562332208.98245104052648; Thu, 23 Aug 2018 15:32:42 -0700 (PDT) Received: from localhost ([::1]:39052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy9h-0007DD-5S for importer@patchew.org; Thu, 23 Aug 2018 18:32:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0N-0005dP-5A for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001FS-5i for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48192 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0F-000164-Ni; Thu, 23 Aug 2018 18:22:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C06F87A7D; Thu, 23 Aug 2018 22:22:55 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0882E1D087; Thu, 23 Aug 2018 22:22:55 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:37 -0400 Message-Id: <20180823222249.13518-2-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 23 Aug 2018 22:22:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 23 Aug 2018 22:22:55 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 01/13] block/commit: add block job creation flags X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for taking and passing forward job creation flags. Signed-off-by: John Snow Reviewed-by: Max Reitz --- block/commit.c | 5 +++-- blockdev.c | 7 ++++--- include/block/block_int.h | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/commit.c b/block/commit.c index da69165de3..b6e8969877 100644 --- a/block/commit.c +++ b/block/commit.c @@ -249,7 +249,8 @@ static BlockDriver bdrv_commit_top =3D { }; =20 void commit_start(const char *job_id, BlockDriverState *bs, - BlockDriverState *base, BlockDriverState *top, int64_t s= peed, + BlockDriverState *base, BlockDriverState *top, + int creation_flags, int64_t speed, BlockdevOnError on_error, const char *backing_file_str, const char *filter_node_name, Error **errp) { @@ -267,7 +268,7 @@ void commit_start(const char *job_id, BlockDriverState = *bs, } =20 s =3D block_job_create(job_id, &commit_job_driver, NULL, bs, 0, BLK_PE= RM_ALL, - speed, JOB_DEFAULT, NULL, NULL, errp); + speed, creation_flags, NULL, NULL, errp); if (!s) { return; } diff --git a/blockdev.c b/blockdev.c index 72f5347df5..c15a1e624b 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3214,6 +3214,7 @@ void qmp_block_commit(bool has_job_id, const char *jo= b_id, const char *device, * BlockdevOnError change for blkmirror makes it in */ BlockdevOnError on_error =3D BLOCKDEV_ON_ERROR_REPORT; + int job_flags =3D JOB_DEFAULT; =20 if (!has_speed) { speed =3D 0; @@ -3295,15 +3296,15 @@ 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, - JOB_DEFAULT, speed, on_error, + job_flags, speed, on_error, filter_node_name, NULL, NULL, false, &local_er= r); } else { BlockDriverState *overlay_bs =3D bdrv_find_overlay(bs, top_bs); if (bdrv_op_is_blocked(overlay_bs, BLOCK_OP_TYPE_COMMIT_TARGET, er= rp)) { goto out; } - commit_start(has_job_id ? job_id : NULL, bs, base_bs, top_bs, spee= d, - on_error, has_backing_file ? backing_file : NULL, + commit_start(has_job_id ? job_id : NULL, bs, base_bs, top_bs, job_= flags, + speed, on_error, has_backing_file ? backing_file : NU= LL, filter_node_name, &local_err); } if (local_err !=3D NULL) { diff --git a/include/block/block_int.h b/include/block/block_int.h index 903b9c1034..ffab0b4d3e 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -980,6 +980,8 @@ void stream_start(const char *job_id, BlockDriverState = *bs, * @bs: Active block device. * @top: Top block device to be committed. * @base: Block device that will be written into, and become the new top. + * @creation_flags: Flags that control the behavior of the Job lifetime. + * See @BlockJobCreateFlags * @speed: The maximum speed, in bytes per second, or 0 for unlimited. * @on_error: The action to take upon error. * @backing_file_str: String to use as the backing file in @top's overlay @@ -990,7 +992,8 @@ void stream_start(const char *job_id, BlockDriverState = *bs, * */ void commit_start(const char *job_id, BlockDriverState *bs, - BlockDriverState *base, BlockDriverState *top, int64_t s= peed, + BlockDriverState *base, BlockDriverState *top, + int creation_flags, int64_t speed, BlockdevOnError on_error, const char *backing_file_str, const char *filter_node_name, Error **errp); /** --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153506313707734.19484993977039; Thu, 23 Aug 2018 15:25:37 -0700 (PDT) Received: from localhost ([::1]:39010 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy2p-0007P4-O6 for importer@patchew.org; Thu, 23 Aug 2018 18:25:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0M-0005cd-Mr for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001FD-3h for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53792 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0G-00016o-1S; Thu, 23 Aug 2018 18:22:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AD9CE40216E7; Thu, 23 Aug 2018 22:22:55 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EB61B279D; Thu, 23 Aug 2018 22:22:55 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:38 -0400 Message-Id: <20180823222249.13518-3-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:55 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 02/13] block/mirror: add block job creation flags X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for taking and passing forward job creaton flags. Signed-off-by: John Snow Reviewed-by: Max Reitz --- block/mirror.c | 5 +++-- blockdev.c | 3 ++- include/block/block_int.h | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 57b4ac97d8..837279e979 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1639,7 +1639,8 @@ fail: =20 void mirror_start(const char *job_id, BlockDriverState *bs, BlockDriverState *target, const char *replaces, - int64_t speed, uint32_t granularity, int64_t buf_size, + int creation_flags, int64_t speed, + uint32_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockMirrorBackingMode backing_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, @@ -1655,7 +1656,7 @@ void mirror_start(const char *job_id, BlockDriverStat= e *bs, } is_none_mode =3D mode =3D=3D MIRROR_SYNC_MODE_NONE; base =3D mode =3D=3D MIRROR_SYNC_MODE_TOP ? backing_bs(bs) : NULL; - mirror_start_job(job_id, bs, JOB_DEFAULT, target, replaces, + mirror_start_job(job_id, bs, creation_flags, target, replaces, speed, granularity, buf_size, backing_mode, on_source_error, on_target_error, unmap, NULL, NULL, &mirror_job_driver, is_none_mode, base, false, diff --git a/blockdev.c b/blockdev.c index c15a1e624b..6574356708 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3590,6 +3590,7 @@ static void blockdev_mirror_common(const char *job_id= , BlockDriverState *bs, bool has_copy_mode, MirrorCopyMode copy= _mode, Error **errp) { + int job_flags =3D JOB_DEFAULT; =20 if (!has_speed) { speed =3D 0; @@ -3642,7 +3643,7 @@ static void blockdev_mirror_common(const char *job_id= , BlockDriverState *bs, * and will allow to check whether the node still exist at mirror comp= letion */ mirror_start(job_id, bs, target, - has_replaces ? replaces : NULL, + has_replaces ? replaces : NULL, job_flags, speed, granularity, buf_size, sync, backing_mode, on_source_error, on_target_error, unmap, filter_node_name, copy_mode, errp); diff --git a/include/block/block_int.h b/include/block/block_int.h index ffab0b4d3e..b40f0bfc9b 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1029,6 +1029,8 @@ void commit_active_start(const char *job_id, BlockDri= verState *bs, * @target: Block device to write to. * @replaces: Block graph node name to replace once the mirror is done. Can * only be used when full mirroring is selected. + * @creation_flags: Flags that control the behavior of the Job lifetime. + * See @BlockJobCreateFlags * @speed: The maximum speed, in bytes per second, or 0 for unlimited. * @granularity: The chosen granularity for the dirty bitmap. * @buf_size: The amount of data that can be in flight at one time. @@ -1050,7 +1052,8 @@ void commit_active_start(const char *job_id, BlockDri= verState *bs, */ void mirror_start(const char *job_id, BlockDriverState *bs, BlockDriverState *target, const char *replaces, - int64_t speed, uint32_t granularity, int64_t buf_size, + int creation_flags, int64_t speed, + uint32_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockMirrorBackingMode backing_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063137752798.9814954119748; Thu, 23 Aug 2018 15:25:37 -0700 (PDT) Received: from localhost ([::1]:39009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy2q-0007OL-BH for importer@patchew.org; Thu, 23 Aug 2018 18:25:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0M-0005cR-ID for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001Ez-2V for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51038 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0G-00017M-Cj; Thu, 23 Aug 2018 18:22:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D8D7DFE2; Thu, 23 Aug 2018 22:22:56 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2EAAAB5AE; Thu, 23 Aug 2018 22:22:55 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:39 -0400 Message-Id: <20180823222249.13518-4-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 23 Aug 2018 22:22:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 23 Aug 2018 22:22:56 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 03/13] block/stream: add block job creation flags X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for taking and passing forward job creaton flags. Signed-off-by: John Snow Reviewed-by: Max Reitz --- block/stream.c | 5 +++-- blockdev.c | 3 ++- include/block/block_int.h | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/block/stream.c b/block/stream.c index 67e1e72e23..700eb239e4 100644 --- a/block/stream.c +++ b/block/stream.c @@ -214,7 +214,8 @@ static const BlockJobDriver stream_job_driver =3D { =20 void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, - int64_t speed, BlockdevOnError on_error, Error **errp) + int creation_flags, int64_t speed, + BlockdevOnError on_error, Error **errp) { StreamBlockJob *s; BlockDriverState *iter; @@ -236,7 +237,7 @@ void stream_start(const char *job_id, BlockDriverState = *bs, BLK_PERM_GRAPH_MOD, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE_UNCHANG= ED | BLK_PERM_WRITE, - speed, JOB_DEFAULT, NULL, NULL, errp); + speed, creation_flags, NULL, NULL, errp); if (!s) { goto fail; } diff --git a/blockdev.c b/blockdev.c index 6574356708..ec90eb1cf9 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3123,6 +3123,7 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, AioContext *aio_context; Error *local_err =3D NULL; const char *base_name =3D NULL; + int job_flags =3D JOB_DEFAULT; =20 if (!has_on_error) { on_error =3D BLOCKDEV_ON_ERROR_REPORT; @@ -3185,7 +3186,7 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, base_name =3D has_backing_file ? backing_file : base_name; =20 stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name, - has_speed ? speed : 0, on_error, &local_err); + job_flags, has_speed ? speed : 0, on_error, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; diff --git a/include/block/block_int.h b/include/block/block_int.h index b40f0bfc9b..4000d2af45 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -958,6 +958,8 @@ int is_windows_drive(const char *filename); * flatten the whole backing file chain onto @bs. * @backing_file_str: The file name that will be written to @bs as the * the new backing file if the job completes. Ignored if @base is %NULL. + * @creation_flags: Flags that control the behavior of the Job lifetime. + * See @BlockJobCreateFlags * @speed: The maximum speed, in bytes per second, or 0 for unlimited. * @on_error: The action to take upon error. * @errp: Error object. @@ -971,7 +973,8 @@ int is_windows_drive(const char *filename); */ void stream_start(const char *job_id, BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, - int64_t speed, BlockdevOnError on_error, Error **errp); + int creation_flags, int64_t speed, + BlockdevOnError on_error, Error **errp); =20 /** * commit_start: --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063779636700.151963048027; Thu, 23 Aug 2018 15:36:19 -0700 (PDT) Received: from localhost ([::1]:39075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsyDC-0001kz-I5 for importer@patchew.org; Thu, 23 Aug 2018 18:36:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0N-0005eA-Ie for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001G9-Cy for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37210 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0G-00017f-PB; Thu, 23 Aug 2018 18:22:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6556040255CF; Thu, 23 Aug 2018 22:22:56 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 14EFBAB5AE; Thu, 23 Aug 2018 22:22:56 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:40 -0400 Message-Id: <20180823222249.13518-5-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 23 Aug 2018 22:22:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 23 Aug 2018 22:22:56 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 04/13] block/commit: refactor commit to use job callbacks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use the component callbacks; prepare, abort, and clean. NB: prepare is only called when the job has not yet failed; and abort can be called after prepare. complete -> prepare -> abort -> clean complete -> abort -> clean Signed-off-by: John Snow Reviewed-by: Max Reitz --- block/commit.c | 90 ++++++++++++++++++++++++++++++++----------------------= ---- 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/block/commit.c b/block/commit.c index b6e8969877..9bf50385cf 100644 --- a/block/commit.c +++ b/block/commit.c @@ -36,6 +36,7 @@ typedef struct CommitBlockJob { BlockDriverState *commit_top_bs; BlockBackend *top; BlockBackend *base; + BlockDriverState *base_bs; BlockdevOnError on_error; int base_flags; char *backing_file_str; @@ -68,61 +69,65 @@ static int coroutine_fn commit_populate(BlockBackend *b= s, BlockBackend *base, return 0; } =20 -static void commit_exit(Job *job) +static int commit_prepare(Job *job) { CommitBlockJob *s =3D container_of(job, CommitBlockJob, common.job); - BlockJob *bjob =3D &s->common; - BlockDriverState *top =3D blk_bs(s->top); - BlockDriverState *base =3D blk_bs(s->base); - BlockDriverState *commit_top_bs =3D s->commit_top_bs; - bool remove_commit_top_bs =3D false; - - /* Make sure commit_top_bs and top stay around until bdrv_replace_node= () */ - bdrv_ref(top); - bdrv_ref(commit_top_bs); =20 /* Remove base node parent that still uses BLK_PERM_WRITE/RESIZE before * the normal backing chain can be restored. */ blk_unref(s->base); + s->base =3D NULL; =20 - if (!job_is_cancelled(job) && job->ret =3D=3D 0) { - /* success */ - job->ret =3D bdrv_drop_intermediate(s->commit_top_bs, base, - s->backing_file_str); - } else { - /* XXX Can (or should) we somehow keep 'consistent read' blocked e= ven - * after the failed/cancelled commit job is gone? If we already wr= ote - * something to base, the intermediate images aren't valid any mor= e. */ - remove_commit_top_bs =3D true; + return bdrv_drop_intermediate(s->commit_top_bs, s->base_bs, + s->backing_file_str); +} + +static void commit_abort(Job *job) +{ + CommitBlockJob *s =3D container_of(job, CommitBlockJob, common.job); + BlockDriverState *top_bs =3D blk_bs(s->top); + + /* Make sure commit_top_bs and top stay around until bdrv_replace_node= () */ + bdrv_ref(top_bs); + bdrv_ref(s->commit_top_bs); + + if (s->base) { + blk_unref(s->base); } =20 + /* free the blockers on the intermediate nodes so that bdrv_replace_no= des + * can succeed */ + block_job_remove_all_bdrv(&s->common); + + /* If bdrv_drop_intermediate() didn't already do that, remove the comm= it + * filter driver from the backing chain. Do this as the final step so = that + * the 'consistent read' permission can be granted. + * + * XXX Can (or should) we somehow keep 'consistent read' blocked even + * after the failed/cancelled commit job is gone? If we already wrote + * something to base, the intermediate images aren't valid any more. */ + bdrv_child_try_set_perm(s->commit_top_bs->backing, 0, BLK_PERM_ALL, + &error_abort); + bdrv_replace_node(s->commit_top_bs, backing_bs(s->commit_top_bs), + &error_abort); + + bdrv_unref(s->commit_top_bs); + bdrv_unref(top_bs); +} + +static void commit_clean(Job *job) +{ + CommitBlockJob *s =3D container_of(job, CommitBlockJob, common.job); + /* restore base open flags here if appropriate (e.g., change the base = back * to r/o). These reopens do not need to be atomic, since we won't abo= rt * even on failure here */ - if (s->base_flags !=3D bdrv_get_flags(base)) { - bdrv_reopen(base, s->base_flags, NULL); + if (s->base_flags !=3D bdrv_get_flags(s->base_bs)) { + bdrv_reopen(s->base_bs, s->base_flags, NULL); } + g_free(s->backing_file_str); blk_unref(s->top); - - /* If there is more than one reference to the job (e.g. if called from - * job_finish_sync()), job_completed() won't free it and therefore the - * blockers on the intermediate nodes remain. This would cause - * bdrv_set_backing_hd() to fail. */ - block_job_remove_all_bdrv(bjob); - - /* If bdrv_drop_intermediate() didn't already do that, remove the comm= it - * filter driver from the backing chain. Do this as the final step so = that - * the 'consistent read' permission can be granted. */ - if (remove_commit_top_bs) { - bdrv_child_try_set_perm(commit_top_bs->backing, 0, BLK_PERM_ALL, - &error_abort); - bdrv_replace_node(commit_top_bs, backing_bs(commit_top_bs), - &error_abort); - } - - bdrv_unref(commit_top_bs); - bdrv_unref(top); } =20 static int coroutine_fn commit_run(Job *job, Error **errp) @@ -211,7 +216,9 @@ static const BlockJobDriver commit_job_driver =3D { .user_resume =3D block_job_user_resume, .drain =3D block_job_drain, .run =3D commit_run, - .exit =3D commit_exit, + .prepare =3D commit_prepare, + .abort =3D commit_abort, + .clean =3D commit_clean }, }; =20 @@ -345,6 +352,7 @@ void commit_start(const char *job_id, BlockDriverState = *bs, if (ret < 0) { goto fail; } + s->base_bs =3D base; =20 /* Required permissions are already taken with block_job_add_bdrv() */ s->top =3D blk_new(0, BLK_PERM_ALL); --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063488255107.1651970162934; Thu, 23 Aug 2018 15:31:28 -0700 (PDT) Received: from localhost ([::1]:39049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy8P-0006NO-5j for importer@patchew.org; Thu, 23 Aug 2018 18:31:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0N-0005dY-6y for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001G3-CW for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:03 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53798 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0H-00018O-2q; Thu, 23 Aug 2018 18:22:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA45340216E7; Thu, 23 Aug 2018 22:22:56 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CF43B2795; Thu, 23 Aug 2018 22:22:56 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:41 -0400 Message-Id: <20180823222249.13518-6-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:56 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:56 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 05/13] block/mirror: conservative mirror_exit refactor X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For purposes of minimum code movement, refactor the mirror_exit callback to use the post-finalization callbacks in a trivial way. Signed-off-by: John Snow --- block/mirror.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/block/mirror.c b/block/mirror.c index 837279e979..f5b504406d 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -79,6 +79,7 @@ typedef struct MirrorBlockJob { int max_iov; bool initial_zeroing_ongoing; int in_active_write_counter; + bool prepared; } MirrorBlockJob; =20 typedef struct MirrorBDSOpaque { @@ -607,7 +608,7 @@ static void mirror_wait_for_all_io(MirrorBlockJob *s) } } =20 -static void mirror_exit(Job *job) +static int mirror_exit_common(Job *job) { MirrorBlockJob *s =3D container_of(job, MirrorBlockJob, common.job); BlockJob *bjob =3D &s->common; @@ -619,6 +620,11 @@ static void mirror_exit(Job *job) Error *local_err =3D NULL; int ret =3D job->ret; =20 + if (s->prepared) { + return ret; + } + s->prepared =3D true; + bdrv_release_dirty_bitmap(src, s->dirty_bitmap); =20 /* Make sure that the source BDS doesn't go away before we called @@ -711,7 +717,17 @@ static void mirror_exit(Job *job) bdrv_unref(mirror_top_bs); bdrv_unref(src); =20 - job->ret =3D ret; + return ret; +} + +static int mirror_prepare(Job *job) +{ + return mirror_exit_common(job); +} + +static void mirror_abort(Job *job) +{ + mirror_exit_common(job); } =20 static void mirror_throttle(MirrorBlockJob *s) @@ -1132,7 +1148,8 @@ static const BlockJobDriver mirror_job_driver =3D { .user_resume =3D block_job_user_resume, .drain =3D block_job_drain, .run =3D mirror_run, - .exit =3D mirror_exit, + .prepare =3D mirror_prepare, + .abort =3D mirror_abort, .pause =3D mirror_pause, .complete =3D mirror_complete, }, @@ -1149,7 +1166,8 @@ static const BlockJobDriver commit_active_job_driver = =3D { .user_resume =3D block_job_user_resume, .drain =3D block_job_drain, .run =3D mirror_run, - .exit =3D mirror_exit, + .prepare =3D mirror_prepare, + .abort =3D mirror_abort, .pause =3D mirror_pause, .complete =3D mirror_complete, }, --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063191988956.4661203171214; Thu, 23 Aug 2018 15:26:31 -0700 (PDT) Received: from localhost ([::1]:39016 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy3i-0000Mt-VA for importer@patchew.org; Thu, 23 Aug 2018 18:26:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0M-0005cb-Mm for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001FO-4i for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40678 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0H-00018t-Dx; Thu, 23 Aug 2018 18:22:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BD89804BAAC; Thu, 23 Aug 2018 22:22:57 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0D59B27AA; Thu, 23 Aug 2018 22:22:56 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:42 -0400 Message-Id: <20180823222249.13518-7-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 23 Aug 2018 22:22:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 23 Aug 2018 22:22:57 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 06/13] block/commit: refactor stream to use job callbacks X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz --- block/stream.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/block/stream.c b/block/stream.c index 700eb239e4..81a7ec8ece 100644 --- a/block/stream.c +++ b/block/stream.c @@ -54,16 +54,16 @@ static int coroutine_fn stream_populate(BlockBackend *b= lk, return blk_co_preadv(blk, offset, qiov.size, &qiov, BDRV_REQ_COPY_ON_R= EAD); } =20 -static void stream_exit(Job *job) +static int stream_prepare(Job *job) { StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); BlockJob *bjob =3D &s->common; BlockDriverState *bs =3D blk_bs(bjob->blk); BlockDriverState *base =3D s->base; Error *local_err =3D NULL; - int ret =3D job->ret; + int ret =3D 0; =20 - if (!job_is_cancelled(job) && bs->backing && ret =3D=3D 0) { + if (bs->backing) { const char *base_id =3D NULL, *base_fmt =3D NULL; if (base) { base_id =3D s->backing_file_str; @@ -75,12 +75,19 @@ static void stream_exit(Job *job) bdrv_set_backing_hd(bs, base, &local_err); if (local_err) { error_report_err(local_err); - ret =3D -EPERM; - goto out; + return -EPERM; } } =20 -out: + return ret; +} + +static void stream_clean(Job *job) +{ + StreamBlockJob *s =3D container_of(job, StreamBlockJob, common.job); + BlockJob *bjob =3D &s->common; + BlockDriverState *bs =3D blk_bs(bjob->blk); + /* Reopen the image back in read-only mode if necessary */ if (s->bs_flags !=3D bdrv_get_flags(bs)) { /* Give up write permissions before making it read-only */ @@ -89,7 +96,6 @@ out: } =20 g_free(s->backing_file_str); - job->ret =3D ret; } =20 static int coroutine_fn stream_run(Job *job, Error **errp) @@ -206,7 +212,8 @@ static const BlockJobDriver stream_job_driver =3D { .job_type =3D JOB_TYPE_STREAM, .free =3D block_job_free, .run =3D stream_run, - .exit =3D stream_exit, + .prepare =3D stream_prepare, + .clean =3D stream_clean, .user_resume =3D block_job_user_resume, .drain =3D block_job_drain, }, --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063645097446.12627963597424; Thu, 23 Aug 2018 15:34:05 -0700 (PDT) Received: from localhost ([::1]:39057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsyAx-00086X-Vn for importer@patchew.org; Thu, 23 Aug 2018 18:33:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0N-0005dH-44 for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001F0-2W for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53800 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0H-00019Q-Q1; Thu, 23 Aug 2018 18:22:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 76E0B40216E7; Thu, 23 Aug 2018 22:22:57 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23788B2795; Thu, 23 Aug 2018 22:22:57 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:43 -0400 Message-Id: <20180823222249.13518-8-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:57 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 07/13] tests/blockjob: replace Blockjob with Job X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These tests don't actually test blockjobs anymore, they test generic Job lifetimes. Change the types accordingly. Signed-off-by: John Snow Reviewed-by: Max Reitz --- tests/test-blockjob.c | 98 ++++++++++++++++++++++++++---------------------= ---- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c index ad4a65bc78..8e8b680416 100644 --- a/tests/test-blockjob.c +++ b/tests/test-blockjob.c @@ -206,18 +206,20 @@ static const BlockJobDriver test_cancel_driver =3D { }, }; =20 -static CancelJob *create_common(BlockJob **pjob) +static CancelJob *create_common(Job **pjob) { BlockBackend *blk; - BlockJob *job; + Job *job; + BlockJob *bjob; CancelJob *s; =20 blk =3D create_blk(NULL); - job =3D mk_job(blk, "Steve", &test_cancel_driver, true, - JOB_MANUAL_FINALIZE | JOB_MANUAL_DISMISS); - job_ref(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_CREATED); - s =3D container_of(job, CancelJob, common); + bjob =3D mk_job(blk, "Steve", &test_cancel_driver, true, + JOB_MANUAL_FINALIZE | JOB_MANUAL_DISMISS); + job =3D &bjob->job; + job_ref(job); + assert(job->status =3D=3D JOB_STATUS_CREATED); + s =3D container_of(bjob, CancelJob, common); s->blk =3D blk; =20 *pjob =3D job; @@ -242,7 +244,7 @@ static void cancel_common(CancelJob *s) =20 static void test_cancel_created(void) { - BlockJob *job; + Job *job; CancelJob *s; =20 s =3D create_common(&job); @@ -251,119 +253,119 @@ static void test_cancel_created(void) =20 static void test_cancel_running(void) { - BlockJob *job; + Job *job; CancelJob *s; =20 s =3D create_common(&job); =20 - job_start(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_RUNNING); + job_start(job); + assert(job->status =3D=3D JOB_STATUS_RUNNING); =20 cancel_common(s); } =20 static void test_cancel_paused(void) { - BlockJob *job; + Job *job; CancelJob *s; =20 s =3D create_common(&job); =20 - job_start(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_RUNNING); + job_start(job); + assert(job->status =3D=3D JOB_STATUS_RUNNING); =20 - job_user_pause(&job->job, &error_abort); - job_enter(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_PAUSED); + job_user_pause(job, &error_abort); + job_enter(job); + assert(job->status =3D=3D JOB_STATUS_PAUSED); =20 cancel_common(s); } =20 static void test_cancel_ready(void) { - BlockJob *job; + Job *job; CancelJob *s; =20 s =3D create_common(&job); =20 - job_start(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_RUNNING); + job_start(job); + assert(job->status =3D=3D JOB_STATUS_RUNNING); =20 s->should_converge =3D true; - job_enter(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_READY); + job_enter(job); + assert(job->status =3D=3D JOB_STATUS_READY); =20 cancel_common(s); } =20 static void test_cancel_standby(void) { - BlockJob *job; + Job *job; CancelJob *s; =20 s =3D create_common(&job); =20 - job_start(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_RUNNING); + job_start(job); + assert(job->status =3D=3D JOB_STATUS_RUNNING); =20 s->should_converge =3D true; - job_enter(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_READY); + job_enter(job); + assert(job->status =3D=3D JOB_STATUS_READY); =20 - job_user_pause(&job->job, &error_abort); - job_enter(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_STANDBY); + job_user_pause(job, &error_abort); + job_enter(job); + assert(job->status =3D=3D JOB_STATUS_STANDBY); =20 cancel_common(s); } =20 static void test_cancel_pending(void) { - BlockJob *job; + Job *job; CancelJob *s; =20 s =3D create_common(&job); =20 - job_start(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_RUNNING); + job_start(job); + assert(job->status =3D=3D JOB_STATUS_RUNNING); =20 s->should_converge =3D true; - job_enter(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_READY); + job_enter(job); + assert(job->status =3D=3D JOB_STATUS_READY); =20 - job_complete(&job->job, &error_abort); - job_enter(&job->job); + job_complete(job, &error_abort); + job_enter(job); while (!s->completed) { aio_poll(qemu_get_aio_context(), true); } - assert(job->job.status =3D=3D JOB_STATUS_PENDING); + assert(job->status =3D=3D JOB_STATUS_PENDING); =20 cancel_common(s); } =20 static void test_cancel_concluded(void) { - BlockJob *job; + Job *job; CancelJob *s; =20 s =3D create_common(&job); =20 - job_start(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_RUNNING); + job_start(job); + assert(job->status =3D=3D JOB_STATUS_RUNNING); =20 s->should_converge =3D true; - job_enter(&job->job); - assert(job->job.status =3D=3D JOB_STATUS_READY); + job_enter(job); + assert(job->status =3D=3D JOB_STATUS_READY); =20 - job_complete(&job->job, &error_abort); - job_enter(&job->job); + job_complete(job, &error_abort); + job_enter(job); while (!s->completed) { aio_poll(qemu_get_aio_context(), true); } - assert(job->job.status =3D=3D JOB_STATUS_PENDING); + assert(job->status =3D=3D JOB_STATUS_PENDING); =20 - job_finalize(&job->job, &error_abort); - assert(job->job.status =3D=3D JOB_STATUS_CONCLUDED); + job_finalize(job, &error_abort); + assert(job->status =3D=3D JOB_STATUS_CONCLUDED); =20 cancel_common(s); } --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063396651921.6774887972701; Thu, 23 Aug 2018 15:29:56 -0700 (PDT) Received: from localhost ([::1]:39034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy71-0003d1-G0 for importer@patchew.org; Thu, 23 Aug 2018 18:29:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0M-0005cf-OE for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001Fn-A6 for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39660 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0I-00019m-5i; Thu, 23 Aug 2018 18:22:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE65A40241ED; Thu, 23 Aug 2018 22:22:57 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F258B2795; Thu, 23 Aug 2018 22:22:57 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:44 -0400 Message-Id: <20180823222249.13518-9-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 23 Aug 2018 22:22:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 23 Aug 2018 22:22:57 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 08/13] tests/test-blockjob: remove exit callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We remove the exit callback and the completed boolean along with it. We can simulate it just fine by waiting for the job to defer to the main loop, and then giving it one final kick to get the main loop portion to run. Signed-off-by: John Snow Reviewed-by: Max Reitz --- tests/test-blockjob.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/test-blockjob.c b/tests/test-blockjob.c index 8e8b680416..de4c1c20aa 100644 --- a/tests/test-blockjob.c +++ b/tests/test-blockjob.c @@ -160,15 +160,8 @@ typedef struct CancelJob { BlockBackend *blk; bool should_converge; bool should_complete; - bool completed; } CancelJob; =20 -static void cancel_job_exit(Job *job) -{ - CancelJob *s =3D container_of(job, CancelJob, common.job); - s->completed =3D true; -} - static void cancel_job_complete(Job *job, Error **errp) { CancelJob *s =3D container_of(job, CancelJob, common.job); @@ -201,7 +194,6 @@ static const BlockJobDriver test_cancel_driver =3D { .user_resume =3D block_job_user_resume, .drain =3D block_job_drain, .run =3D cancel_job_run, - .exit =3D cancel_job_exit, .complete =3D cancel_job_complete, }, }; @@ -335,9 +327,11 @@ static void test_cancel_pending(void) =20 job_complete(job, &error_abort); job_enter(job); - while (!s->completed) { + while (!job->deferred_to_main_loop) { aio_poll(qemu_get_aio_context(), true); } + assert(job->status =3D=3D JOB_STATUS_READY); + aio_poll(qemu_get_aio_context(), true); assert(job->status =3D=3D JOB_STATUS_PENDING); =20 cancel_common(s); @@ -359,9 +353,11 @@ static void test_cancel_concluded(void) =20 job_complete(job, &error_abort); job_enter(job); - while (!s->completed) { + while (!job->deferred_to_main_loop) { aio_poll(qemu_get_aio_context(), true); } + assert(job->status =3D=3D JOB_STATUS_READY); + aio_poll(qemu_get_aio_context(), true); assert(job->status =3D=3D JOB_STATUS_PENDING); =20 job_finalize(job, &error_abort); --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063315910908.6542217337995; Thu, 23 Aug 2018 15:28:35 -0700 (PDT) Received: from localhost ([::1]:39032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy5d-0002X5-OF for importer@patchew.org; Thu, 23 Aug 2018 18:28:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0O-0005fb-T7 for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0N-0001JZ-Bk for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40680 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0I-0001AC-OW; Thu, 23 Aug 2018 18:22:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30EA8804BAAC; Thu, 23 Aug 2018 22:22:58 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5E72B2795; Thu, 23 Aug 2018 22:22:57 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:45 -0400 Message-Id: <20180823222249.13518-10-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 23 Aug 2018 22:22:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 23 Aug 2018 22:22:58 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 09/13] jobs: remove .exit callback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that all of the jobs use the component finalization callbacks, there's no use for the heavy-hammer .exit callback anymore. job_exit becomes a glorified type shim so that we can call job_completed from aio_bh_schedule_oneshot. Move these three functions down into job.c to eliminate a forward reference. Signed-off-by: John Snow Reviewed-by: Max Reitz --- include/qemu/job.h | 11 ------- job.c | 77 +++++++++++++++++++++----------------------= ---- tests/test-blockjob-txn.c | 4 +-- 3 files changed, 36 insertions(+), 56 deletions(-) diff --git a/include/qemu/job.h b/include/qemu/job.h index 858cc2b37a..c5409c4b2d 100644 --- a/include/qemu/job.h +++ b/include/qemu/job.h @@ -213,17 +213,6 @@ struct JobDriver { */ void (*drain)(Job *job); =20 - /** - * If the callback is not NULL, exit will be invoked from the main thr= ead - * when the job's coroutine has finished, but before transactional - * convergence; before @prepare or @abort. - * - * FIXME TODO: This callback is only temporary to transition remaining= jobs - * to prepare/commit/abort/clean callbacks and will be removed before = 3.1. - * is released. - */ - void (*exit)(Job *job); - /** * If the callback is not NULL, prepare will be invoked when all the j= obs * belonging to the same transaction complete; or upon this job's comp= letion diff --git a/job.c b/job.c index 01dd97fee3..72f7de1f36 100644 --- a/job.c +++ b/job.c @@ -535,49 +535,6 @@ void job_drain(Job *job) } } =20 -static void job_completed(Job *job); - -static void job_exit(void *opaque) -{ - Job *job =3D (Job *)opaque; - AioContext *aio_context =3D job->aio_context; - - if (job->driver->exit) { - aio_context_acquire(aio_context); - job->driver->exit(job); - aio_context_release(aio_context); - } - job_completed(job); -} - -/** - * All jobs must allow a pause point before entering their job proper. This - * ensures that jobs can be paused prior to being started, then resumed la= ter. - */ -static void coroutine_fn job_co_entry(void *opaque) -{ - Job *job =3D opaque; - - assert(job && job->driver && job->driver->run); - job_pause_point(job); - job->ret =3D job->driver->run(job, &job->err); - job->deferred_to_main_loop =3D true; - aio_bh_schedule_oneshot(qemu_get_aio_context(), job_exit, job); -} - - -void job_start(Job *job) -{ - assert(job && !job_started(job) && job->paused && - job->driver && job->driver->run); - job->co =3D qemu_coroutine_create(job_co_entry, job); - job->pause_count--; - job->busy =3D true; - job->paused =3D false; - job_state_transition(job, JOB_STATUS_RUNNING); - aio_co_enter(job->aio_context, job->co); -} - /* Assumes the block_job_mutex is held */ static bool job_timer_not_pending(Job *job) { @@ -894,6 +851,40 @@ static void job_completed(Job *job) } } =20 +/** Useful only as a type shim for aio_bh_schedule_oneshot. */ +static void job_exit(void *opaque) +{ + Job *job =3D (Job *)opaque; + job_completed(job); +} + +/** + * All jobs must allow a pause point before entering their job proper. This + * ensures that jobs can be paused prior to being started, then resumed la= ter. + */ +static void coroutine_fn job_co_entry(void *opaque) +{ + Job *job =3D opaque; + + assert(job && job->driver && job->driver->run); + job_pause_point(job); + job->ret =3D job->driver->run(job, &job->err); + job->deferred_to_main_loop =3D true; + aio_bh_schedule_oneshot(qemu_get_aio_context(), job_exit, job); +} + +void job_start(Job *job) +{ + assert(job && !job_started(job) && job->paused && + job->driver && job->driver->run); + job->co =3D qemu_coroutine_create(job_co_entry, job); + job->pause_count--; + job->busy =3D true; + job->paused =3D false; + job_state_transition(job, JOB_STATUS_RUNNING); + aio_co_enter(job->aio_context, job->co); +} + void job_cancel(Job *job, bool force) { if (job->status =3D=3D JOB_STATUS_CONCLUDED) { diff --git a/tests/test-blockjob-txn.c b/tests/test-blockjob-txn.c index ef29f35e44..86606f92b3 100644 --- a/tests/test-blockjob-txn.c +++ b/tests/test-blockjob-txn.c @@ -24,7 +24,7 @@ typedef struct { int *result; } TestBlockJob; =20 -static void test_block_job_exit(Job *job) +static void test_block_job_clean(Job *job) { BlockJob *bjob =3D container_of(job, BlockJob, job); BlockDriverState *bs =3D blk_bs(bjob->blk); @@ -73,7 +73,7 @@ static const BlockJobDriver test_block_job_driver =3D { .user_resume =3D block_job_user_resume, .drain =3D block_job_drain, .run =3D test_block_job_run, - .exit =3D test_block_job_exit, + .clean =3D test_block_job_clean, }, }; =20 --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063368057114.34385703210626; Thu, 23 Aug 2018 15:29:28 -0700 (PDT) Received: from localhost ([::1]:39033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy6Y-0003Fq-OP for importer@patchew.org; Thu, 23 Aug 2018 18:29:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0N-0005dF-3E for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0L-0001GW-IK for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:02 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53802 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0I-0001AX-Rw; Thu, 23 Aug 2018 18:22:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83E7040216E7; Thu, 23 Aug 2018 22:22:58 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37448B278C; Thu, 23 Aug 2018 22:22:58 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:46 -0400 Message-Id: <20180823222249.13518-11-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 23 Aug 2018 22:22:58 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 10/13] qapi/block-commit: expose new job properties X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz --- blockdev.c | 8 ++++++++ qapi/block-core.json | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index ec90eb1cf9..98b91e75a7 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3204,6 +3204,8 @@ void qmp_block_commit(bool has_job_id, const char *jo= b_id, const char *device, bool has_backing_file, const char *backing_file, bool has_speed, int64_t speed, bool has_filter_node_name, const char *filter_node_n= ame, + bool has_auto_finalize, bool auto_finalize, + bool has_auto_dismiss, bool auto_dismiss, Error **errp) { BlockDriverState *bs; @@ -3223,6 +3225,12 @@ void qmp_block_commit(bool has_job_id, const char *j= ob_id, const char *device, if (!has_filter_node_name) { filter_node_name =3D NULL; } + if (has_auto_finalize && !auto_finalize) { + job_flags |=3D JOB_MANUAL_FINALIZE; + } + if (has_auto_dismiss && !auto_dismiss) { + job_flags |=3D JOB_MANUAL_DISMISS; + } =20 /* Important Note: * libvirt relies on the DeviceNotFound error class in order to probe= for diff --git a/qapi/block-core.json b/qapi/block-core.json index 4c7a37afdc..d5b62e50d7 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1498,6 +1498,19 @@ # above @top. If this option is not given, a node name = is # autogenerated. (Since: 2.9) # +# @auto-finalize: When false, this job will wait in a PENDING state after = it has +# finished its work, waiting for @block-job-finalize before +# making any block graph changes. +# When true, this job will automatically +# perform its abort or commit actions. +# Defaults to true. (Since 3.1) +# +# @auto-dismiss: When false, this job will wait in a CONCLUDED state after= it +# has completely ceased all work, and awaits @block-job-dis= miss. +# When true, this job will automatically disappear from the= query +# list without user intervention. +# Defaults to true. (Since 3.1) +# # Returns: Nothing on success # If @device does not exist, DeviceNotFound # Any other error returns a GenericError. @@ -1515,7 +1528,8 @@ { 'command': 'block-commit', 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'st= r', '*backing-file': 'str', '*speed': 'int', - '*filter-node-name': 'str' } } + '*filter-node-name': 'str', + '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } =20 ## # @drive-backup: --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063484805334.62192749382757; Thu, 23 Aug 2018 15:31:24 -0700 (PDT) Received: from localhost ([::1]:39050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy8R-0006O8-Ev for importer@patchew.org; Thu, 23 Aug 2018 18:31:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0O-0005fe-U5 for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0N-0001Jq-FU for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48198 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0J-0001Bc-Di; Thu, 23 Aug 2018 18:22:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9B6C87A76; Thu, 23 Aug 2018 22:22:58 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B4F8B2795; Thu, 23 Aug 2018 22:22:58 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:47 -0400 Message-Id: <20180823222249.13518-12-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 23 Aug 2018 22:22:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 23 Aug 2018 22:22:58 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 11/13] qapi/block-mirror: expose new job properties X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz --- blockdev.c | 14 ++++++++++++++ qapi/block-core.json | 30 ++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 98b91e75a7..429cdf9901 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3597,6 +3597,8 @@ static void blockdev_mirror_common(const char *job_id= , BlockDriverState *bs, bool has_filter_node_name, const char *filter_node_name, bool has_copy_mode, MirrorCopyMode copy= _mode, + bool has_auto_finalize, bool auto_final= ize, + bool has_auto_dismiss, bool auto_dismis= s, Error **errp) { int job_flags =3D JOB_DEFAULT; @@ -3625,6 +3627,12 @@ static void blockdev_mirror_common(const char *job_i= d, BlockDriverState *bs, if (!has_copy_mode) { copy_mode =3D MIRROR_COPY_MODE_BACKGROUND; } + if (has_auto_finalize && !auto_finalize) { + job_flags |=3D JOB_MANUAL_FINALIZE; + } + if (has_auto_dismiss && !auto_dismiss) { + job_flags |=3D JOB_MANUAL_DISMISS; + } =20 if (granularity !=3D 0 && (granularity < 512 || granularity > 1048576 = * 64)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", @@ -3802,6 +3810,8 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp) arg->has_unmap, arg->unmap, false, NULL, arg->has_copy_mode, arg->copy_mode, + arg->has_auto_finalize, arg->auto_finalize, + arg->has_auto_dismiss, arg->auto_dismiss, &local_err); bdrv_unref(target_bs); error_propagate(errp, local_err); @@ -3823,6 +3833,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char = *job_id, bool has_filter_node_name, const char *filter_node_name, bool has_copy_mode, MirrorCopyMode copy_mode, + bool has_auto_finalize, bool auto_finalize, + bool has_auto_dismiss, bool auto_dismiss, Error **errp) { BlockDriverState *bs; @@ -3856,6 +3868,8 @@ void qmp_blockdev_mirror(bool has_job_id, const char = *job_id, true, true, has_filter_node_name, filter_node_name, has_copy_mode, copy_mode, + has_auto_finalize, auto_finalize, + has_auto_dismiss, auto_dismiss, &local_err); error_propagate(errp, local_err); =20 diff --git a/qapi/block-core.json b/qapi/block-core.json index d5b62e50d7..e785c2e9fe 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1729,6 +1729,18 @@ # @copy-mode: when to copy data to the destination; defaults to 'backgroun= d' # (Since: 3.0) # +# @auto-finalize: When false, this job will wait in a PENDING state after = it has +# finished its work, waiting for @block-job-finalize before +# making any block graph changes. +# When true, this job will automatically +# perform its abort or commit actions. +# Defaults to true. (Since 3.1) +# +# @auto-dismiss: When false, this job will wait in a CONCLUDED state after= it +# has completely ceased all work, and awaits @block-job-dis= miss. +# When true, this job will automatically disappear from the= query +# list without user intervention. +# Defaults to true. (Since 3.1) # Since: 1.3 ## { 'struct': 'DriveMirror', @@ -1738,7 +1750,8 @@ '*speed': 'int', '*granularity': 'uint32', '*buf-size': 'int', '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', - '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode' } } + '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode', + '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } =20 ## # @BlockDirtyBitmap: @@ -2004,6 +2017,18 @@ # @copy-mode: when to copy data to the destination; defaults to 'backgroun= d' # (Since: 3.0) # +# @auto-finalize: When false, this job will wait in a PENDING state after = it has +# finished its work, waiting for @block-job-finalize before +# making any block graph changes. +# When true, this job will automatically +# perform its abort or commit actions. +# Defaults to true. (Since 3.1) +# +# @auto-dismiss: When false, this job will wait in a CONCLUDED state after= it +# has completely ceased all work, and awaits @block-job-dis= miss. +# When true, this job will automatically disappear from the= query +# list without user intervention. +# Defaults to true. (Since 3.1) # Returns: nothing on success. # # Since: 2.6 @@ -2025,7 +2050,8 @@ '*buf-size': 'int', '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', '*filter-node-name': 'str', - '*copy-mode': 'MirrorCopyMode' } } + '*copy-mode': 'MirrorCopyMode', + '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } =20 ## # @block_set_io_throttle: --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063715650418.3154642766177; Thu, 23 Aug 2018 15:35:15 -0700 (PDT) Received: from localhost ([::1]:39062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsyCA-0000W6-IR for importer@patchew.org; Thu, 23 Aug 2018 18:35:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0O-0005fL-JH for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0N-0001Ji-Db for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40682 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0J-0001CR-Lo; Thu, 23 Aug 2018 18:22:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 392E4804BAAC; Thu, 23 Aug 2018 22:22:59 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0E81B27A7; Thu, 23 Aug 2018 22:22:58 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:48 -0400 Message-Id: <20180823222249.13518-13-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 23 Aug 2018 22:22:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 23 Aug 2018 22:22:59 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 12/13] qapi/block-stream: expose new job properties X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: John Snow Reviewed-by: Max Reitz --- blockdev.c | 9 +++++++++ hmp.c | 5 +++-- qapi/block-core.json | 16 +++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/blockdev.c b/blockdev.c index 429cdf9901..0cf8febe6c 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3116,6 +3116,8 @@ void qmp_block_stream(bool has_job_id, const char *jo= b_id, const char *device, bool has_backing_file, const char *backing_file, bool has_speed, int64_t speed, bool has_on_error, BlockdevOnError on_error, + bool has_auto_finalize, bool auto_finalize, + bool has_auto_dismiss, bool auto_dismiss, Error **errp) { BlockDriverState *bs, *iter; @@ -3185,6 +3187,13 @@ void qmp_block_stream(bool has_job_id, const char *j= ob_id, const char *device, /* backing_file string overrides base bs filename */ base_name =3D has_backing_file ? backing_file : base_name; =20 + if (has_auto_finalize && !auto_finalize) { + job_flags |=3D JOB_MANUAL_FINALIZE; + } + if (has_auto_dismiss && !auto_dismiss) { + job_flags |=3D JOB_MANUAL_DISMISS; + } + stream_start(has_job_id ? job_id : NULL, bs, base_bs, base_name, job_flags, has_speed ? speed : 0, on_error, &local_err); if (local_err) { diff --git a/hmp.c b/hmp.c index 2aafb50e8e..e3c3ecd76f 100644 --- a/hmp.c +++ b/hmp.c @@ -1865,8 +1865,9 @@ void hmp_block_stream(Monitor *mon, const QDict *qdic= t) int64_t speed =3D qdict_get_try_int(qdict, "speed", 0); =20 qmp_block_stream(true, device, device, base !=3D NULL, base, false, NU= LL, - false, NULL, qdict_haskey(qdict, "speed"), speed, - true, BLOCKDEV_ON_ERROR_REPORT, &error); + false, NULL, qdict_haskey(qdict, "speed"), speed, tru= e, + BLOCKDEV_ON_ERROR_REPORT, false, false, false, false, + &error); =20 hmp_handle_error(mon, &error); } diff --git a/qapi/block-core.json b/qapi/block-core.json index e785c2e9fe..f877e9e414 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2317,6 +2317,19 @@ # 'stop' and 'enospc' can only be used if the block device # supports io-status (see BlockInfo). Since 1.3. # +# @auto-finalize: When false, this job will wait in a PENDING state after = it has +# finished its work, waiting for @block-job-finalize before +# making any block graph changes. +# When true, this job will automatically +# perform its abort or commit actions. +# Defaults to true. (Since 3.1) +# +# @auto-dismiss: When false, this job will wait in a CONCLUDED state after= it +# has completely ceased all work, and awaits @block-job-dis= miss. +# When true, this job will automatically disappear from the= query +# list without user intervention. +# Defaults to true. (Since 3.1) +# # Returns: Nothing on success. If @device does not exist, DeviceNotFound. # # Since: 1.1 @@ -2332,7 +2345,8 @@ { 'command': 'block-stream', 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*base-node': 'str', '*backing-file': 'str', '*speed': 'int', - '*on-error': 'BlockdevOnError' } } + '*on-error': 'BlockdevOnError', + '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } =20 ## # @block-job-set-speed: --=20 2.14.4 From nobody Wed Nov 5 12:15:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535063887735286.3934958546894; Thu, 23 Aug 2018 15:38:07 -0700 (PDT) Received: from localhost ([::1]:39083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsyEw-000450-Dk for importer@patchew.org; Thu, 23 Aug 2018 18:38:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsy0O-0005fC-Hf for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsy0N-0001JU-Ag for qemu-devel@nongnu.org; Thu, 23 Aug 2018 18:23:04 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51040 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsy0J-0001Cw-Uj; Thu, 23 Aug 2018 18:23:00 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C4697A7E8; Thu, 23 Aug 2018 22:22:59 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-97.bos.redhat.com [10.18.17.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4062DB2792; Thu, 23 Aug 2018 22:22:59 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Thu, 23 Aug 2018 18:22:49 -0400 Message-Id: <20180823222249.13518-14-jsnow@redhat.com> In-Reply-To: <20180823222249.13518-1-jsnow@redhat.com> References: <20180823222249.13518-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 23 Aug 2018 22:22:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 23 Aug 2018 22:22:59 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 13/13] block/backup: qapi documentation fixup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , jtc@redhat.com, "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fix documentation to match the other jobs amended for 3.1. Signed-off-by: John Snow --- qapi/block-core.json | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index f877e9e414..c0b3d33dbb 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1272,13 +1272,14 @@ # a different block device than @device). # # @auto-finalize: When false, this job will wait in a PENDING state after = it has -# finished its work, waiting for @block-job-finalize. -# When true, this job will automatically perform its abort= or -# commit actions. +# finished its work, waiting for @block-job-finalize before +# making any block graph changes. +# When true, this job will automatically +# perform its abort or commit actions. # Defaults to true. (Since 2.12) # # @auto-dismiss: When false, this job will wait in a CONCLUDED state after= it -# has completed ceased all work, and wait for @block-job-di= smiss. +# has completely ceased all work, and awaits @block-job-dis= miss. # When true, this job will automatically disappear from the= query # list without user intervention. # Defaults to true. (Since 2.12) @@ -1327,13 +1328,14 @@ # a different block device than @device). # # @auto-finalize: When false, this job will wait in a PENDING state after = it has -# finished its work, waiting for @block-job-finalize. -# When true, this job will automatically perform its abort= or -# commit actions. +# finished its work, waiting for @block-job-finalize before +# making any block graph changes. +# When true, this job will automatically +# perform its abort or commit actions. # Defaults to true. (Since 2.12) # # @auto-dismiss: When false, this job will wait in a CONCLUDED state after= it -# has completed ceased all work, and wait for @block-job-di= smiss. +# has completely ceased all work, and awaits @block-job-dis= miss. # When true, this job will automatically disappear from the= query # list without user intervention. # Defaults to true. (Since 2.12) --=20 2.14.4