[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/14] block/backup: implement .cancel job handler
From: |
Eric Blake |
Subject: |
[PULL 13/14] block/backup: implement .cancel job handler |
Date: |
Fri, 12 Feb 2021 14:16:18 -0600 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
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-10-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
block/backup.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block/backup.c b/block/backup.c
index cc525d55445e..94e6dcd72e33 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -35,6 +35,7 @@ typedef struct BackupBlockJob {
BlockJob common;
BlockDriverState *backup_top;
BlockDriverState *source_bs;
+ BlockDriverState *target_bs;
BdrvDirtyBitmap *sync_bitmap;
@@ -329,6 +330,13 @@ static void coroutine_fn backup_set_speed(BlockJob *job,
int64_t speed)
}
}
+static void backup_cancel(Job *job)
+{
+ BackupBlockJob *s = container_of(job, BackupBlockJob, common.job);
+
+ bdrv_cancel_in_flight(s->target_bs);
+}
+
static const BlockJobDriver backup_job_driver = {
.job_driver = {
.instance_size = sizeof(BackupBlockJob),
@@ -340,6 +348,7 @@ static const BlockJobDriver backup_job_driver = {
.abort = backup_abort,
.clean = backup_clean,
.pause = backup_pause,
+ .cancel = backup_cancel,
},
.set_speed = backup_set_speed,
};
@@ -528,6 +537,7 @@ BlockJob *backup_job_create(const char *job_id,
BlockDriverState *bs,
job->backup_top = backup_top;
job->source_bs = bs;
+ job->target_bs = target;
job->on_source_error = on_source_error;
job->on_target_error = on_target_error;
job->sync_mode = sync_mode;
--
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, 2021/02/12
- [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 <=
- [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