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