[PATCH] libxl: remove redundant variable from libxlDomainJobObj

Kristina Hanicova khanicov at redhat.com
Mon Feb 28 10:49:23 UTC 2022


It makes no sense to have 'started' variable in the
libxlDomainJobObj as the same one is already in virDomainJobData,
but never used.

Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
---
 src/libxl/libxl_domain.c | 10 +++++-----
 src/libxl/libxl_domain.h |  1 -
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index ee031267ca..205049f98a 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -118,7 +118,7 @@ libxlDomainObjBeginJob(libxlDriverPrivate *driver G_GNUC_UNUSED,
     VIR_DEBUG("Starting job: %s", libxlDomainJobTypeToString(job));
     priv->job.active = job;
     priv->job.owner = virThreadSelfID();
-    priv->job.started = now;
+    priv->job.current->started = now;
     priv->job.current->jobType = VIR_DOMAIN_JOB_UNBOUNDED;
 
     return 0;
@@ -171,18 +171,18 @@ libxlDomainJobUpdateTime(struct libxlDomainJobObj *job)
     virDomainJobData *jobData = job->current;
     unsigned long long now;
 
-    if (!job->started)
+    if (!jobData->started)
         return 0;
 
     if (virTimeMillisNow(&now) < 0)
         return -1;
 
-    if (now < job->started) {
-        job->started = 0;
+    if (now < jobData->started) {
+        jobData->started = 0;
         return 0;
     }
 
-    jobData->timeElapsed = now - job->started;
+    jobData->timeElapsed = now - jobData->started;
     return 0;
 }
 
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index 475e4a6933..157f480b93 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -46,7 +46,6 @@ struct libxlDomainJobObj {
     virCond cond;                       /* Use to coordinate jobs */
     enum libxlDomainJob active;         /* Currently running job */
     int owner;                          /* Thread which set current job */
-    unsigned long long started;         /* When the job started */
     virDomainJobData *current;        /* Statistics for the current job */
 };
 
-- 
2.35.1




More information about the libvir-list mailing list