From nobody Fri Oct 24 09:53:13 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 1519430384039680.4811726913395; Fri, 23 Feb 2018 15:59:44 -0800 (PST) Received: from localhost ([::1]:47909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epNFd-00043I-VR for importer@patchew.org; Fri, 23 Feb 2018 18:59:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1epN8P-0005vW-4W for qemu-devel@nongnu.org; Fri, 23 Feb 2018 18:52:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1epN8N-00061C-0S for qemu-devel@nongnu.org; Fri, 23 Feb 2018 18:52:13 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33882 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 1epN8E-0005is-RY; Fri, 23 Feb 2018 18:52:03 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3608E400186C; Fri, 23 Feb 2018 23:51:52 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-231.bos.redhat.com [10.18.17.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05A4610A9DC0; Fri, 23 Feb 2018 23:51:52 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org Date: Fri, 23 Feb 2018 18:51:24 -0500 Message-Id: <20180223235142.21501-4-jsnow@redhat.com> In-Reply-To: <20180223235142.21501-1-jsnow@redhat.com> References: <20180223235142.21501-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 23 Feb 2018 23:51:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 23 Feb 2018 23:51:52 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [RFC v4 03/21] blockjobs: add manual property 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 , pkrempa@redhat.com, jtc@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This property will be used to opt-in to the new BlockJobs workflow that allows a tighter, more explicit control over transitions from one runstate to another. While we're here, fix up the documentation for block_job_create a little bit. Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf --- blockjob.c | 1 + include/block/blockjob.h | 10 ++++++++++ include/block/blockjob_int.h | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/blockjob.c b/blockjob.c index 7ba3683ee3..47468331ec 100644 --- a/blockjob.c +++ b/blockjob.c @@ -700,6 +700,7 @@ void *block_job_create(const char *job_id, const BlockJ= obDriver *driver, job->paused =3D true; job->pause_count =3D 1; job->refcnt =3D 1; + job->manual =3D (flags & BLOCK_JOB_MANUAL); aio_timer_init(qemu_get_aio_context(), &job->sleep_timer, QEMU_CLOCK_REALTIME, SCALE_NS, block_job_sleep_timer_cb, job); diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 00403d9482..8ffabdcbc4 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -141,14 +141,24 @@ typedef struct BlockJob { */ QEMUTimer sleep_timer; =20 + /** + * Set to true when the management API has requested manual job + * management semantics. + */ + bool manual; + /** Non-NULL if this job is part of a transaction */ BlockJobTxn *txn; QLIST_ENTRY(BlockJob) txn_list; } BlockJob; =20 typedef enum BlockJobCreateFlags { + /* Default behavior */ BLOCK_JOB_DEFAULT =3D 0x00, + /* BlockJob is not QMP-created and should not send QMP events */ BLOCK_JOB_INTERNAL =3D 0x01, + /* BlockJob requests manual job management steps. */ + BLOCK_JOB_MANUAL =3D 0x02, } BlockJobCreateFlags; =20 /** diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h index becaae74c2..259d49b32a 100644 --- a/include/block/blockjob_int.h +++ b/include/block/blockjob_int.h @@ -114,11 +114,13 @@ struct BlockJobDriver { * block_job_create: * @job_id: The id of the newly-created job, or %NULL to have one * generated automatically. - * @job_type: The class object for the newly-created job. + * @driver: The class object for the newly-created job. * @txn: The transaction this job belongs to, if any. %NULL otherwise. * @bs: The block * @perm, @shared_perm: Permissions to request for @bs * @speed: The maximum speed, in bytes per second, or 0 for unlimited. + * @flags: Creation flags for the Block Job. + * See @BlockJobCreateFlags * @cb: Completion function for the job. * @opaque: Opaque pointer value passed to @cb. * @errp: Error object. --=20 2.14.3