From nobody Tue Feb 10 19:14:54 2026 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507082133896202.2480600142568; Tue, 3 Oct 2017 18:55:33 -0700 (PDT) Received: from localhost ([::1]:60996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzYuL-0007wh-64 for importer@patchew.org; Tue, 03 Oct 2017 21:55:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzYrC-0005kM-RS for qemu-devel@nongnu.org; Tue, 03 Oct 2017 21:52:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dzYrB-0000Iz-Uj for qemu-devel@nongnu.org; Tue, 03 Oct 2017 21:52:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41406) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dzYr9-0000Gq-TR; Tue, 03 Oct 2017 21:52:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2147859F7; Wed, 4 Oct 2017 01:52:14 +0000 (UTC) Received: from probe.redhat.com (ovpn-120-249.rdu2.redhat.com [10.10.120.249]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C257600C8; Wed, 4 Oct 2017 01:52:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E2147859F7 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jsnow@redhat.com From: John Snow To: qemu-block@nongnu.org Date: Tue, 3 Oct 2017 21:52:03 -0400 Message-Id: <20171004015205.20724-3-jsnow@redhat.com> In-Reply-To: <20171004015205.20724-1-jsnow@redhat.com> References: <20171004015205.20724-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 04 Oct 2017 01:52:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/4] qmp: add block-job-reap command 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" For jobs that have finished (either completed or canceled), allow the user to dismiss the job's status reports via block-job-reap. Signed-off-by: John Snow --- block/trace-events | 1 + blockdev.c | 14 ++++++++++++++ qapi/block-core.json | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/block/trace-events b/block/trace-events index 25dd5a3..9580efa 100644 --- a/block/trace-events +++ b/block/trace-events @@ -46,6 +46,7 @@ qmp_block_job_cancel(void *job) "job %p" qmp_block_job_pause(void *job) "job %p" qmp_block_job_resume(void *job) "job %p" qmp_block_job_complete(void *job) "job %p" +qmp_block_job_reap(void *job) "job %p" qmp_block_stream(void *bs, void *job) "bs %p job %p" =20 # block/file-win32.c diff --git a/blockdev.c b/blockdev.c index eeb4986..c08d6fb 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3766,6 +3766,20 @@ void qmp_block_job_complete(const char *device, Erro= r **errp) aio_context_release(aio_context); } =20 +void qmp_block_job_reap(const char *device, Error **errp) +{ + AioContext *aio_context; + BlockJob *job =3D find_block_job(device, &aio_context, errp); + + if (!job) { + return; + } + + trace_qmp_block_job_reap(job); + block_job_reap(&job, errp); + aio_context_release(aio_context); +} + void qmp_change_backing_file(const char *device, const char *image_node_name, const char *backing_file, diff --git a/qapi/block-core.json b/qapi/block-core.json index a4f5e10..5cce49d 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2161,6 +2161,27 @@ { 'command': 'block-job-complete', 'data': { 'device': 'str' } } =20 ## +# @block-job-reap: +# +# For jobs that have already completed, remove them from the block-job-que= ry +# list. This command only needs to be run for jobs which were started with= the +# persistent=3Dtrue option. +# +# This command will refuse to operate on any job that has not yet reached +# its terminal state. "cancel" or "complete" will still need to be used as +# appropriate. +# +# @device: The job identifier. This used to be a device name (hence +# the name of the parameter), but since QEMU 2.7 it can have +# other values. +# +# Returns: Nothing on success +# +# Since: 2.11 +## +{ 'command': 'block-job-reap', 'data': { 'device': 'str' } } + +## # @BlockdevDiscardOptions: # # Determines how to handle discard requests. --=20 2.9.5