mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
job: Move cancelled to Job
We cannot yet move the whole logic around job cancelling to Job because it depends on quite a few other things that are still only in BlockJob, but we can move the cancelled field at least. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
80fa2c756b
commit
daa7f2f946
11 changed files with 50 additions and 52 deletions
|
@ -622,7 +622,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
|
|||
|
||||
mirror_throttle(s);
|
||||
|
||||
if (block_job_is_cancelled(&s->common)) {
|
||||
if (job_is_cancelled(&s->common.job)) {
|
||||
s->initial_zeroing_ongoing = false;
|
||||
return 0;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ static int coroutine_fn mirror_dirty_init(MirrorBlockJob *s)
|
|||
|
||||
mirror_throttle(s);
|
||||
|
||||
if (block_job_is_cancelled(&s->common)) {
|
||||
if (job_is_cancelled(&s->common.job)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -695,7 +695,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||
checking for a NULL string */
|
||||
int ret = 0;
|
||||
|
||||
if (block_job_is_cancelled(&s->common)) {
|
||||
if (job_is_cancelled(&s->common.job)) {
|
||||
goto immediate_exit;
|
||||
}
|
||||
|
||||
|
@ -729,10 +729,10 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||
/* Report BLOCK_JOB_READY and wait for complete. */
|
||||
block_job_event_ready(&s->common);
|
||||
s->synced = true;
|
||||
while (!block_job_is_cancelled(&s->common) && !s->should_complete) {
|
||||
while (!job_is_cancelled(&s->common.job) && !s->should_complete) {
|
||||
block_job_yield(&s->common);
|
||||
}
|
||||
s->common.cancelled = false;
|
||||
s->common.job.cancelled = false;
|
||||
goto immediate_exit;
|
||||
}
|
||||
|
||||
|
@ -768,7 +768,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||
s->last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
|
||||
if (!s->is_none_mode) {
|
||||
ret = mirror_dirty_init(s);
|
||||
if (ret < 0 || block_job_is_cancelled(&s->common)) {
|
||||
if (ret < 0 || job_is_cancelled(&s->common.job)) {
|
||||
goto immediate_exit;
|
||||
}
|
||||
}
|
||||
|
@ -828,7 +828,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||
}
|
||||
|
||||
should_complete = s->should_complete ||
|
||||
block_job_is_cancelled(&s->common);
|
||||
job_is_cancelled(&s->common.job);
|
||||
cnt = bdrv_get_dirty_count(s->dirty_bitmap);
|
||||
}
|
||||
|
||||
|
@ -856,7 +856,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||
* completion.
|
||||
*/
|
||||
assert(QLIST_EMPTY(&bs->tracked_requests));
|
||||
s->common.cancelled = false;
|
||||
s->common.job.cancelled = false;
|
||||
need_drain = false;
|
||||
break;
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ static void coroutine_fn mirror_run(void *opaque)
|
|||
}
|
||||
trace_mirror_before_sleep(s, cnt, s->synced, delay_ns);
|
||||
block_job_sleep_ns(&s->common, delay_ns);
|
||||
if (block_job_is_cancelled(&s->common) &&
|
||||
if (job_is_cancelled(&s->common.job) &&
|
||||
(!s->synced || s->common.force))
|
||||
{
|
||||
break;
|
||||
|
@ -884,7 +884,7 @@ immediate_exit:
|
|||
* the target is a copy of the source.
|
||||
*/
|
||||
assert(ret < 0 || ((s->common.force || !s->synced) &&
|
||||
block_job_is_cancelled(&s->common)));
|
||||
job_is_cancelled(&s->common.job)));
|
||||
assert(need_drain);
|
||||
mirror_wait_for_all_io(s);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue