[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/14] job: add .cancel handler for the driver
From: |
Eric Blake |
Subject: |
[PULL 08/14] job: add .cancel handler for the driver |
Date: |
Fri, 12 Feb 2021 14:16:13 -0600 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To be used in mirror in the following commit to cancel in-flight io on
target to not waste the time.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210205163720.887197-5-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
include/qemu/job.h | 5 +++++
job.c | 3 +++
2 files changed, 8 insertions(+)
diff --git a/include/qemu/job.h b/include/qemu/job.h
index 32aabb1c6000..efc6fa754498 100644
--- a/include/qemu/job.h
+++ b/include/qemu/job.h
@@ -251,6 +251,11 @@ struct JobDriver {
*/
void (*clean)(Job *job);
+ /**
+ * If the callback is not NULL, it will be invoked in job_cancel_async
+ */
+ void (*cancel)(Job *job);
+
/** Called when the job is freed */
void (*free)(Job *job);
diff --git a/job.c b/job.c
index 3aaaebafe2c8..289edee14374 100644
--- a/job.c
+++ b/job.c
@@ -715,6 +715,9 @@ static int job_finalize_single(Job *job)
static void job_cancel_async(Job *job, bool force)
{
+ if (job->driver->cancel) {
+ job->driver->cancel(job);
+ }
if (job->user_paused) {
/* Do not call job_enter here, the caller will handle it. */
if (job->driver->user_resume) {
--
2.30.1
- [PULL 00/14] NBD patches through 2021-02-12, Eric Blake, 2021/02/12
- [PULL 01/14] qemu-nbd: Use SOMAXCONN for socket listen() backlog, Eric Blake, 2021/02/12
- [PULL 04/14] io: error_prepend() in qio_channel_readv_full_all() causes segfault, Eric Blake, 2021/02/12
- [PULL 02/14] qemu-nbd: Permit --shared=0 for unlimited clients, Eric Blake, 2021/02/12
- [PULL 03/14] iotests/210: Fix reference output, Eric Blake, 2021/02/12
- [PULL 05/14] block: add new BlockDriver handler: bdrv_cancel_in_flight, Eric Blake, 2021/02/12
- [PULL 07/14] block/raw-format: implement .bdrv_cancel_in_flight handler, Eric Blake, 2021/02/12
- [PULL 08/14] job: add .cancel handler for the driver,
Eric Blake <=
- [PULL 06/14] block/nbd: implement .bdrv_cancel_in_flight, Eric Blake, 2021/02/12
- [PULL 09/14] block/mirror: implement .cancel job handler, Eric Blake, 2021/02/12
- [PULL 13/14] block/backup: implement .cancel job handler, Eric Blake, 2021/02/12
- [PULL 14/14] iotests/264: add backup-cancel test-case, Eric Blake, 2021/02/12
- [PULL 11/14] iotests.py: qemu_nbd_popen: remove pid file after use, Eric Blake, 2021/02/12
- [PULL 12/14] iotests/264: add mirror-cancel test-case, Eric Blake, 2021/02/12
- [PULL 10/14] iotests/264: move to python unittest, Eric Blake, 2021/02/12
- Re: [PULL 00/14] NBD patches through 2021-02-12, Peter Maydell, 2021/02/13