[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/11] block/backup: implement .cancel job handler
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH 10/11] block/backup: implement .cancel job handler |
Date: |
Wed, 18 Nov 2020 21:04:32 +0300 |
Cancel in-flight io on target to not waste the time.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
block/backup.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block/backup.c b/block/backup.c
index 9afa0bf3b4..9878594c83 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -36,6 +36,7 @@ typedef struct BackupBlockJob {
BlockJob common;
BlockDriverState *backup_top;
BlockDriverState *source_bs;
+ BlockDriverState *target_bs;
BdrvDirtyBitmap *sync_bitmap;
@@ -279,6 +280,13 @@ static int coroutine_fn backup_run(Job *job, Error **errp)
return ret;
}
+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),
@@ -289,6 +297,7 @@ static const BlockJobDriver backup_job_driver = {
.commit = backup_commit,
.abort = backup_abort,
.clean = backup_clean,
+ .cancel = backup_cancel,
}
};
@@ -456,6 +465,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.21.3
- [PATCH 01/11] block: add new BlockDriver handler: bdrv_cancel_in_flight, (continued)
- [PATCH 01/11] block: add new BlockDriver handler: bdrv_cancel_in_flight, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 02/11] block/nbd: implement .bdrv_cancel_in_flight, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 03/11] block/raw-format: implement .bdrv_cancel_in_flight handler, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 04/11] job: add .cancel handler for the driver, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 05/11] block/mirror: implement .cancel job handler, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 06/11] iotests/264: fix style, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 07/11] iotests/264: move to python unittest, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 09/11] iotests/264: add mirror-cancel test-case, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 08/11] iotests.py: qemu_nbd_popen: remove pid file after use, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 11/11] iotests/264: add backup-cancel test-case, Vladimir Sementsov-Ogievskiy, 2020/11/18
- [PATCH 10/11] block/backup: implement .cancel job handler,
Vladimir Sementsov-Ogievskiy <=
- Re: [PATCH 00/11] mirror: cancel nbd reconnect, Eric Blake, 2020/11/18