mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
7eaa8fb57d
commit
3d70ff53b6
18 changed files with 171 additions and 209 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue