|
|
ae23c9 |
From 2278ae1bb1dbbf0038e4bcc96ecdd875498c5eec Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Date: Tue, 26 Jun 2018 09:48:34 +0200
|
|
|
ae23c9 |
Subject: [PATCH 126/268] blockjob: Remove BlockJob.driver
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180626094856.6924-52-kwolf@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 81123
|
|
|
ae23c9 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 51/73] blockjob: Remove BlockJob.driver
|
|
|
ae23c9 |
Bugzilla: 1513543
|
|
|
ae23c9 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
BlockJob.driver is redundant with Job.driver and only used in very few
|
|
|
ae23c9 |
places any more. Remove it.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 9f6bb4c004a6458227b9eec6aff3f79afe159699)
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
blockjob.c | 17 ++++++++++-------
|
|
|
ae23c9 |
include/block/blockjob.h | 3 ---
|
|
|
ae23c9 |
2 files changed, 10 insertions(+), 10 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/blockjob.c b/blockjob.c
|
|
|
ae23c9 |
index 5c8ff6f..0306533 100644
|
|
|
ae23c9 |
--- a/blockjob.c
|
|
|
ae23c9 |
+++ b/blockjob.c
|
|
|
ae23c9 |
@@ -103,10 +103,12 @@ static void block_job_attached_aio_context(AioContext *new_context,
|
|
|
ae23c9 |
void *opaque)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
BlockJob *job = opaque;
|
|
|
ae23c9 |
+ const JobDriver *drv = job->job.driver;
|
|
|
ae23c9 |
+ BlockJobDriver *bjdrv = container_of(drv, BlockJobDriver, job_driver);
|
|
|
ae23c9 |
|
|
|
ae23c9 |
job->job.aio_context = new_context;
|
|
|
ae23c9 |
- if (job->driver->attached_aio_context) {
|
|
|
ae23c9 |
- job->driver->attached_aio_context(job, new_context);
|
|
|
ae23c9 |
+ if (bjdrv->attached_aio_context) {
|
|
|
ae23c9 |
+ bjdrv->attached_aio_context(job, new_context);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
job_resume(&job->job);
|
|
|
ae23c9 |
@@ -115,10 +117,12 @@ static void block_job_attached_aio_context(AioContext *new_context,
|
|
|
ae23c9 |
void block_job_drain(Job *job)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
BlockJob *bjob = container_of(job, BlockJob, job);
|
|
|
ae23c9 |
+ const JobDriver *drv = job->driver;
|
|
|
ae23c9 |
+ BlockJobDriver *bjdrv = container_of(drv, BlockJobDriver, job_driver);
|
|
|
ae23c9 |
|
|
|
ae23c9 |
blk_drain(bjob->blk);
|
|
|
ae23c9 |
- if (bjob->driver->drain) {
|
|
|
ae23c9 |
- bjob->driver->drain(bjob);
|
|
|
ae23c9 |
+ if (bjdrv->drain) {
|
|
|
ae23c9 |
+ bjdrv->drain(bjob);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@@ -201,7 +205,7 @@ bool block_job_is_internal(BlockJob *job)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
const BlockJobDriver *block_job_driver(BlockJob *job)
|
|
|
ae23c9 |
{
|
|
|
ae23c9 |
- return job->driver;
|
|
|
ae23c9 |
+ return container_of(job->job.driver, BlockJobDriver, job_driver);
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
/* Assumes the job_mutex is held */
|
|
|
ae23c9 |
@@ -386,8 +390,7 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
|
|
|
ae23c9 |
assert(job->job.driver->user_resume == &block_job_user_resume);
|
|
|
ae23c9 |
assert(job->job.driver->drain == &block_job_drain);
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- job->driver = driver;
|
|
|
ae23c9 |
- job->blk = blk;
|
|
|
ae23c9 |
+ job->blk = blk;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
job->finalize_cancelled_notifier.notify = block_job_event_cancelled;
|
|
|
ae23c9 |
job->finalize_completed_notifier.notify = block_job_event_completed;
|
|
|
ae23c9 |
diff --git a/include/block/blockjob.h b/include/block/blockjob.h
|
|
|
ae23c9 |
index 3021d11..32c00b7 100644
|
|
|
ae23c9 |
--- a/include/block/blockjob.h
|
|
|
ae23c9 |
+++ b/include/block/blockjob.h
|
|
|
ae23c9 |
@@ -43,9 +43,6 @@ typedef struct BlockJob {
|
|
|
ae23c9 |
/** Data belonging to the generic Job infrastructure */
|
|
|
ae23c9 |
Job job;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- /** The job type, including the job vtable. */
|
|
|
ae23c9 |
- const BlockJobDriver *driver;
|
|
|
ae23c9 |
-
|
|
|
ae23c9 |
/** The block device on which the job is operating. */
|
|
|
ae23c9 |
BlockBackend *blk;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|