diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-04-24 16:13:52 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-05-23 14:30:51 +0200 |
commit | 3d70ff53b6bf90d9eec6f97024ec9895f6799d9e (patch) | |
tree | 947adf7d4422c78235ff4b8f2a31fac0085efc9a /block | |
parent | 7eaa8fb57da96301f4a8ce176ad503f80efc7cc0 (diff) |
job: Move completion and cancellation to Job
This moves the top-level job completion and cancellation functions from
BlockJob to Job.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/backup.c | 3 | ||||
-rw-r--r-- | block/commit.c | 6 | ||||
-rw-r--r-- | block/mirror.c | 6 | ||||
-rw-r--r-- | block/replication.c | 4 | ||||
-rw-r--r-- | block/stream.c | 2 | ||||
-rw-r--r-- | block/trace-events | 3 |
6 files changed, 10 insertions, 14 deletions
diff --git a/block/backup.c b/block/backup.c index 6172f90c90..b13f91d8a7 100644 --- a/block/backup.c +++ b/block/backup.c @@ -319,10 +319,9 @@ typedef struct { static void backup_complete(Job *job, void *opaque) { - BlockJob *bjob = container_of(job, BlockJob, job); BackupCompleteData *data = opaque; - block_job_completed(bjob, data->ret); + job_completed(job, data->ret); g_free(data); } diff --git a/block/commit.c b/block/commit.c index 40d97a35a5..b0a847e678 100644 --- a/block/commit.c +++ b/block/commit.c @@ -112,12 +112,12 @@ static void commit_complete(Job *job, void *opaque) blk_unref(s->top); /* If there is more than one reference to the job (e.g. if called from - * job_finish_sync()), block_job_completed() won't free it and therefore - * the blockers on the intermediate nodes remain. This would cause + * job_finish_sync()), job_completed() won't free it and therefore the + * blockers on the intermediate nodes remain. This would cause * bdrv_set_backing_hd() to fail. */ block_job_remove_all_bdrv(bjob); - block_job_completed(&s->common, ret); + job_completed(job, ret); g_free(data); /* If bdrv_drop_intermediate() didn't already do that, remove the commit diff --git a/block/mirror.c b/block/mirror.c index 656237af5c..c63cf7cbc9 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -498,7 +498,7 @@ static void mirror_exit(Job *job, void *opaque) bdrv_release_dirty_bitmap(src, s->dirty_bitmap); /* Make sure that the source BDS doesn't go away before we called - * block_job_completed(). */ + * job_completed(). */ bdrv_ref(src); bdrv_ref(mirror_top_bs); bdrv_ref(target_bs); @@ -581,7 +581,7 @@ static void mirror_exit(Job *job, void *opaque) blk_set_perm(bjob->blk, 0, BLK_PERM_ALL, &error_abort); blk_insert_bs(bjob->blk, mirror_top_bs, &error_abort); - block_job_completed(&s->common, data->ret); + job_completed(job, data->ret); g_free(data); bdrv_drained_end(src); @@ -954,7 +954,7 @@ static void mirror_complete(Job *job, Error **errp) } s->should_complete = true; - block_job_enter(&s->common); + job_enter(job); } static void mirror_pause(Job *job) diff --git a/block/replication.c b/block/replication.c index ff2e2028af..826db7b304 100644 --- a/block/replication.c +++ b/block/replication.c @@ -145,7 +145,7 @@ static void replication_close(BlockDriverState *bs) replication_stop(s->rs, false, NULL); } if (s->stage == BLOCK_REPLICATION_FAILOVER) { - block_job_cancel_sync(s->active_disk->bs->job); + job_cancel_sync(&s->active_disk->bs->job->job); } if (s->mode == REPLICATION_MODE_SECONDARY) { @@ -681,7 +681,7 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp) * disk, secondary disk in backup_job_completed(). */ if (s->secondary_disk->bs->job) { - block_job_cancel_sync(s->secondary_disk->bs->job); + job_cancel_sync(&s->secondary_disk->bs->job->job); } if (!failover) { diff --git a/block/stream.c b/block/stream.c index b996278ab3..8546c412cd 100644 --- a/block/stream.c +++ b/block/stream.c @@ -93,7 +93,7 @@ out: } g_free(s->backing_file_str); - block_job_completed(&s->common, data->ret); + job_completed(job, data->ret); g_free(data); } diff --git a/block/trace-events b/block/trace-events index 93b927908a..2d59b53fd3 100644 --- a/block/trace-events +++ b/block/trace-events @@ -4,9 +4,6 @@ bdrv_open_common(void *bs, const char *filename, int flags, const char *format_name) "bs %p filename \"%s\" flags 0x%x format_name \"%s\"" bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d" -# blockjob.c -block_job_completed(void *job, int ret, int jret) "job %p ret %d corrected ret %d" - # block/block-backend.c blk_co_preadv(void *blk, void *bs, int64_t offset, unsigned int bytes, int flags) "blk %p bs %p offset %"PRId64" bytes %u flags 0x%x" blk_co_pwritev(void *blk, void *bs, int64_t offset, unsigned int bytes, int flags) "blk %p bs %p offset %"PRId64" bytes %u flags 0x%x" |