[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 40/56] block/block-copy: make setting progress optional
From: |
Hanna Reitz |
Subject: |
[PULL 40/56] block/block-copy: make setting progress optional |
Date: |
Wed, 1 Sep 2021 17:16:03 +0200 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Now block-copy will crash if user don't set progress meter by
block_copy_set_progress_meter(). copy-before-write filter will be used
in separate of backup job, and it doesn't want any progress meter (for
now). So, allow not setting it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210824083856.17408-21-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
---
block/block-copy.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/block/block-copy.c b/block/block-copy.c
index 5d0076ac93..443261e4e4 100644
--- a/block/block-copy.c
+++ b/block/block-copy.c
@@ -292,9 +292,11 @@ static void coroutine_fn block_copy_task_end(BlockCopyTask
*task, int ret)
bdrv_set_dirty_bitmap(task->s->copy_bitmap, task->offset, task->bytes);
}
QLIST_REMOVE(task, list);
- progress_set_remaining(task->s->progress,
- bdrv_get_dirty_count(task->s->copy_bitmap) +
- task->s->in_flight_bytes);
+ if (task->s->progress) {
+ progress_set_remaining(task->s->progress,
+ bdrv_get_dirty_count(task->s->copy_bitmap) +
+ task->s->in_flight_bytes);
+ }
qemu_co_queue_restart_all(&task->wait_queue);
}
@@ -594,7 +596,7 @@ static coroutine_fn int block_copy_task_entry(AioTask *task)
t->call_state->ret = ret;
t->call_state->error_is_read = error_is_read;
}
- } else {
+ } else if (s->progress) {
progress_work_done(s->progress, t->bytes);
}
}
@@ -700,9 +702,11 @@ int64_t block_copy_reset_unallocated(BlockCopyState *s,
if (!ret) {
qemu_co_mutex_lock(&s->lock);
bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes);
- progress_set_remaining(s->progress,
- bdrv_get_dirty_count(s->copy_bitmap) +
- s->in_flight_bytes);
+ if (s->progress) {
+ progress_set_remaining(s->progress,
+ bdrv_get_dirty_count(s->copy_bitmap) +
+ s->in_flight_bytes);
+ }
qemu_co_mutex_unlock(&s->lock);
}
--
2.31.1
- [PULL 27/56] block/block-copy: introduce block_copy_set_copy_opts(), (continued)
- [PULL 27/56] block/block-copy: introduce block_copy_set_copy_opts(), Hanna Reitz, 2021/09/01
- [PULL 31/56] block/copy-before-write: drop extra bdrv_unref on failure path, Hanna Reitz, 2021/09/01
- [PULL 29/56] block/backup: move cluster size calculation to block-copy, Hanna Reitz, 2021/09/01
- [PULL 33/56] block/copy-before-write: bdrv_cbw_append(): replace child at last, Hanna Reitz, 2021/09/01
- [PULL 30/56] block/copy-before-write: relax permission requirements when no parents, Hanna Reitz, 2021/09/01
- [PULL 32/56] block/copy-before-write: use file child instead of backing, Hanna Reitz, 2021/09/01
- [PULL 36/56] block/copy-before-write: cbw_init(): use file child after attaching, Hanna Reitz, 2021/09/01
- [PULL 37/56] block/copy-before-write: bdrv_cbw_append(): drop unused compress arg, Hanna Reitz, 2021/09/01
- [PULL 35/56] block/copy-before-write: cbw_init(): rename variables, Hanna Reitz, 2021/09/01
- [PULL 38/56] block/copy-before-write: cbw_init(): use options, Hanna Reitz, 2021/09/01
- [PULL 40/56] block/block-copy: make setting progress optional,
Hanna Reitz <=
- [PULL 41/56] block/copy-before-write: make public block driver, Hanna Reitz, 2021/09/01
- [PULL 34/56] block/copy-before-write: introduce cbw_init(), Hanna Reitz, 2021/09/01
- [PULL 39/56] block/copy-before-write: initialize block-copy bitmap, Hanna Reitz, 2021/09/01
- [PULL 42/56] qapi: publish copy-before-write filter, Hanna Reitz, 2021/09/01
- [PULL 44/56] python/qemu/machine: QEMUMachine: improve qmp() method, Hanna Reitz, 2021/09/01
- [PULL 43/56] python/qemu/machine.py: refactor _qemu_args(), Hanna Reitz, 2021/09/01
- [PULL 45/56] python:QEMUMachine: template typing for self returning methods, Hanna Reitz, 2021/09/01
- [PULL 46/56] iotests/222: fix pylint and mypy complains, Hanna Reitz, 2021/09/01