|
|
26ba25 |
From 5845c03f7bd9ad3759eb63977eecb7412f6250aa Mon Sep 17 00:00:00 2001
|
|
|
26ba25 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Date: Tue, 26 Jun 2018 09:48:02 +0200
|
|
|
26ba25 |
Subject: [PATCH 094/268] job: Add job_delete()
|
|
|
26ba25 |
|
|
|
26ba25 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Message-id: <20180626094856.6924-20-kwolf@redhat.com>
|
|
|
26ba25 |
Patchwork-id: 81065
|
|
|
26ba25 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 19/73] job: Add job_delete()
|
|
|
26ba25 |
Bugzilla: 1513543
|
|
|
26ba25 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
26ba25 |
|
|
|
26ba25 |
This moves freeing the Job object and its fields from block_job_unref()
|
|
|
26ba25 |
to job_delete().
|
|
|
26ba25 |
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Reviewed-by: Max Reitz <mreitz@redhat.com>
|
|
|
26ba25 |
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
|
26ba25 |
(cherry picked from commit fd61a701f1de8e4c1d89b3716ba9ca749cf5c724)
|
|
|
26ba25 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
26ba25 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
26ba25 |
---
|
|
|
26ba25 |
blockjob.c | 3 +--
|
|
|
26ba25 |
include/qemu/job.h | 3 +++
|
|
|
26ba25 |
job.c | 6 ++++++
|
|
|
26ba25 |
3 files changed, 10 insertions(+), 2 deletions(-)
|
|
|
26ba25 |
|
|
|
26ba25 |
diff --git a/blockjob.c b/blockjob.c
|
|
|
26ba25 |
index ea71ec0..430a67b 100644
|
|
|
26ba25 |
--- a/blockjob.c
|
|
|
26ba25 |
+++ b/blockjob.c
|
|
|
26ba25 |
@@ -261,9 +261,8 @@ void block_job_unref(BlockJob *job)
|
|
|
26ba25 |
block_job_detach_aio_context, job);
|
|
|
26ba25 |
blk_unref(job->blk);
|
|
|
26ba25 |
error_free(job->blocker);
|
|
|
26ba25 |
- g_free(job->job.id);
|
|
|
26ba25 |
assert(!timer_pending(&job->sleep_timer));
|
|
|
26ba25 |
- g_free(job);
|
|
|
26ba25 |
+ job_delete(&job->job);
|
|
|
26ba25 |
}
|
|
|
26ba25 |
}
|
|
|
26ba25 |
|
|
|
26ba25 |
diff --git a/include/qemu/job.h b/include/qemu/job.h
|
|
|
26ba25 |
index 279ce68..43dc2e4 100644
|
|
|
26ba25 |
--- a/include/qemu/job.h
|
|
|
26ba25 |
+++ b/include/qemu/job.h
|
|
|
26ba25 |
@@ -62,6 +62,9 @@ struct JobDriver {
|
|
|
26ba25 |
*/
|
|
|
26ba25 |
void *job_create(const char *job_id, const JobDriver *driver, Error **errp);
|
|
|
26ba25 |
|
|
|
26ba25 |
+/** Frees the @job object. */
|
|
|
26ba25 |
+void job_delete(Job *job);
|
|
|
26ba25 |
+
|
|
|
26ba25 |
/** Returns the JobType of a given Job. */
|
|
|
26ba25 |
JobType job_type(const Job *job);
|
|
|
26ba25 |
|
|
|
26ba25 |
diff --git a/job.c b/job.c
|
|
|
26ba25 |
index 83724a4..cfdd008 100644
|
|
|
26ba25 |
--- a/job.c
|
|
|
26ba25 |
+++ b/job.c
|
|
|
26ba25 |
@@ -56,3 +56,9 @@ void *job_create(const char *job_id, const JobDriver *driver, Error **errp)
|
|
|
26ba25 |
|
|
|
26ba25 |
return job;
|
|
|
26ba25 |
}
|
|
|
26ba25 |
+
|
|
|
26ba25 |
+void job_delete(Job *job)
|
|
|
26ba25 |
+{
|
|
|
26ba25 |
+ g_free(job->id);
|
|
|
26ba25 |
+ g_free(job);
|
|
|
26ba25 |
+}
|
|
|
26ba25 |
--
|
|
|
26ba25 |
1.8.3.1
|
|
|
26ba25 |
|