diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2021-02-05 19:37:15 +0300 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2021-02-12 11:29:40 -0600 |
commit | 521ff8b779b11c394dbdc43f02e158dd99df308a (patch) | |
tree | 4b4d202e5db680dc342e5e96ae71b0f2ae5da050 /block/mirror.c | |
parent | 9820933b57b24c21a509680650f669123651b60d (diff) | |
download | qemu-521ff8b779b11c394dbdc43f02e158dd99df308a.zip qemu-521ff8b779b11c394dbdc43f02e158dd99df308a.tar.gz qemu-521ff8b779b11c394dbdc43f02e158dd99df308a.tar.bz2 |
block/mirror: implement .cancel job handler
Cancel in-flight io on target to not waste the time.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210205163720.887197-6-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/mirror.c')
-rw-r--r-- | block/mirror.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/block/mirror.c b/block/mirror.c index 8e1ad6e..9faffe4 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -1179,6 +1179,14 @@ static bool mirror_drained_poll(BlockJob *job) return !!s->in_flight; } +static void mirror_cancel(Job *job) +{ + MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job); + BlockDriverState *target = blk_bs(s->target); + + bdrv_cancel_in_flight(target); +} + static const BlockJobDriver mirror_job_driver = { .job_driver = { .instance_size = sizeof(MirrorBlockJob), @@ -1190,6 +1198,7 @@ static const BlockJobDriver mirror_job_driver = { .abort = mirror_abort, .pause = mirror_pause, .complete = mirror_complete, + .cancel = mirror_cancel, }, .drained_poll = mirror_drained_poll, }; |