From nobody Sat May 4 02:36:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638351725; cv=none; d=zohomail.com; s=zohoarc; b=KF0b+pBbBU1MoXyrle49OmdV7zA4OABMPUgHnyxK2IlQBUofyJOalHGHXK58IKNXmAmdOsRf3Mcc2K2KBEqBi/CvvI0eKvB7XFen9+mxLtnjsm2WGlccAl3kG2YCtySHCDEcy2mZF1LNyijmL17plgjGSqj+wqCKLGf1vRv8ZcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638351725; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=wLo8XxBltBwXO521Pq5uApU+2SU2O4EH4vvZTx7rlF0=; b=Vr5TN7OTr3uG12EUrzUGXKebq3CxLj14DiLlF/HxLpqgRfhTm5KQINyE6zowJtp/vgx1Zp5rIqWNPTVuHvGL0B23GqkbYHnNI5ojOHh+FAhQcblEJFRj9vF4XtORGE+gEBhYYUizY7a3MFwaZLBuZXi4RudTkr/DCdmY4l8fFPw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638351725301131.07567268874197; Wed, 1 Dec 2021 01:42:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-njawuza5OyGntiIIDBYeYA-1; Wed, 01 Dec 2021 04:42:00 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6AA519251AF; Wed, 1 Dec 2021 09:41:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1043019D9F; Wed, 1 Dec 2021 09:41:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BFF944BB7C; Wed, 1 Dec 2021 09:41:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B19fjej028121 for ; Wed, 1 Dec 2021 04:41:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id BFFFB10016FE; Wed, 1 Dec 2021 09:41:45 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48B9610013D6 for ; Wed, 1 Dec 2021 09:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638351724; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wLo8XxBltBwXO521Pq5uApU+2SU2O4EH4vvZTx7rlF0=; b=Z+OKAfWA9FfifdzE72i4OBUaoFRaN+KftWCdFaxhkfrNa9smVKtdlQLgkRFHuglnaU/ydy nJCJnChW5yOVoNLMaywcgWdT5lUw8Uq5LxsD9r0lHELfkYVMsDDNXz5+Y+KEWY+qEaPGE3 kthZAk4FJpfNnE9AEz0RilWdPXUpN6c= X-MC-Unique: njawuza5OyGntiIIDBYeYA-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH] qemu_domainjob: move jobs_queued to struct qemuDomainJobObj Date: Wed, 1 Dec 2021 10:41:41 +0100 Message-Id: <7c4b4be0351d1cc7daad48539d689f8a7be353ad.1638351655.git.khanicov@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638351726984100001 Content-Type: text/plain; charset="utf-8" I think it makes more sense for the variable about jobs to be in the job object. I also renamed it to be consistent with the rest of the struct. Signed-off-by: Kristina Hanicova Reviewed-by: J=C3=A1n Tomko --- Not gonna lie, it will make my planned generalization of jobs much easier as well. src/qemu/qemu_domain.h | 2 -- src/qemu/qemu_domainjob.c | 14 +++++++------- src/qemu/qemu_domainjob.h | 2 ++ src/qemu/qemu_process.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 6728ab047e..913c20b941 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -141,8 +141,6 @@ struct _qemuDomainObjPrivate { */ virTristateBool allowReboot; =20 - int jobs_queued; - unsigned long migMaxBandwidth; char *origname; int nbdPort; /* Port used for migration with NBD */ diff --git a/src/qemu/qemu_domainjob.c b/src/qemu/qemu_domainjob.c index cff8d7bb83..62fa09921b 100644 --- a/src/qemu/qemu_domainjob.c +++ b/src/qemu/qemu_domainjob.c @@ -847,13 +847,13 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver, if (virTimeMillisNow(&now) < 0) return -1; =20 - priv->jobs_queued++; + priv->job.jobsQueued++; then =3D now + QEMU_JOB_WAIT_TIME; =20 retry: if ((!async && job !=3D QEMU_JOB_DESTROY) && cfg->maxQueuedJobs && - priv->jobs_queued > cfg->maxQueuedJobs) { + priv->job.jobsQueued > cfg->maxQueuedJobs) { goto error; } =20 @@ -986,7 +986,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver, } ret =3D -2; } else if (cfg->maxQueuedJobs && - priv->jobs_queued > cfg->maxQueuedJobs) { + priv->job.jobsQueued > cfg->maxQueuedJobs) { if (blocker && agentBlocker) { virReportError(VIR_ERR_OPERATION_FAILED, _("cannot acquire state change " @@ -1016,7 +1016,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver, } =20 cleanup: - priv->jobs_queued--; + priv->job.jobsQueued--; return ret; } =20 @@ -1136,7 +1136,7 @@ qemuDomainObjEndJob(virQEMUDriver *driver, virDomainO= bj *obj) qemuDomainObjPrivate *priv =3D obj->privateData; qemuDomainJob job =3D priv->job.active; =20 - priv->jobs_queued--; + priv->job.jobsQueued--; =20 VIR_DEBUG("Stopping job: %s (async=3D%s vm=3D%p name=3D%s)", qemuDomainJobTypeToString(job), @@ -1157,7 +1157,7 @@ qemuDomainObjEndAgentJob(virDomainObj *obj) qemuDomainObjPrivate *priv =3D obj->privateData; qemuDomainAgentJob agentJob =3D priv->job.agentActive; =20 - priv->jobs_queued--; + priv->job.jobsQueued--; =20 VIR_DEBUG("Stopping agent job: %s (async=3D%s vm=3D%p name=3D%s)", qemuDomainAgentJobTypeToString(agentJob), @@ -1175,7 +1175,7 @@ qemuDomainObjEndAsyncJob(virQEMUDriver *driver, virDo= mainObj *obj) { qemuDomainObjPrivate *priv =3D obj->privateData; =20 - priv->jobs_queued--; + priv->job.jobsQueued--; =20 VIR_DEBUG("Stopping async job: %s (vm=3D%p name=3D%s)", qemuDomainAsyncJobTypeToString(priv->job.asyncJob), diff --git a/src/qemu/qemu_domainjob.h b/src/qemu/qemu_domainjob.h index 46cbb8a067..cfef1ff462 100644 --- a/src/qemu/qemu_domainjob.h +++ b/src/qemu/qemu_domainjob.h @@ -176,6 +176,8 @@ struct _qemuDomainObjPrivateJobCallbacks { struct _qemuDomainJobObj { virCond cond; /* Use to coordinate jobs */ =20 + int jobsQueued; + /* The following members are for QEMU_JOB_* */ qemuDomainJob active; /* Currently running job */ unsigned long long owner; /* Thread id which set current job= */ diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c355a39e15..3b07f52954 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3745,7 +3745,7 @@ qemuProcessRecoverJob(virQEMUDriver *driver, ignore_value(virTimeMillisNow(&now)); =20 /* Restore the config of the async job which is not persisted */ - priv->jobs_queued++; + priv->job.jobsQueued++; priv->job.asyncJob =3D QEMU_ASYNC_JOB_BACKUP; priv->job.asyncOwnerAPI =3D g_strdup(virThreadJobGet()); priv->job.asyncStarted =3D now; --=20 2.31.1