[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 3/5] block-copy: move progress_set_remaining in block_copy_tas
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v3 3/5] block-copy: move progress_set_remaining in block_copy_task_end |
Date: |
Tue, 8 Jun 2021 09:33:42 +0200 |
Moving this function in task_end ensures to update the progress
anyways, even if there is an error.
It also helps in next patch, allowing task_end to have only
one critical section.
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
block/block-copy.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/block-copy.c b/block/block-copy.c
index b3533a3003..e2adb5b2ea 100644
--- a/block/block-copy.c
+++ b/block/block-copy.c
@@ -263,6 +263,9 @@ 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);
qemu_co_queue_restart_all(&task->wait_queue);
}
@@ -647,9 +650,6 @@ block_copy_dirty_clusters(BlockCopyCallState *call_state)
}
if (s->skip_unallocated && !(ret & BDRV_BLOCK_ALLOCATED)) {
block_copy_task_end(task, 0);
- progress_set_remaining(s->progress,
- bdrv_get_dirty_count(s->copy_bitmap) +
- s->in_flight_bytes);
trace_block_copy_skip_range(s, task->offset, task->bytes);
offset = task_end(task);
bytes = end - offset;
--
2.30.2
- Re: [PATCH v3 2/5] block-copy: improve comments of BlockCopyTask and BlockCopyState types and functions, (continued)
- Re: [PATCH v3 2/5] block-copy: improve comments of BlockCopyTask and BlockCopyState types and functions, Vladimir Sementsov-Ogievskiy, 2021/06/10
- Re: [PATCH v3 2/5] block-copy: improve comments of BlockCopyTask and BlockCopyState types and functions, Emanuele Giuseppe Esposito, 2021/06/10
- Re: [PATCH v3 2/5] block-copy: improve comments of BlockCopyTask and BlockCopyState types and functions, Vladimir Sementsov-Ogievskiy, 2021/06/10
- Re: [PATCH v3 2/5] block-copy: improve comments of BlockCopyTask and BlockCopyState types and functions, Emanuele Giuseppe Esposito, 2021/06/10
- Re: [PATCH v3 2/5] block-copy: improve comments of BlockCopyTask and BlockCopyState types and functions, Vladimir Sementsov-Ogievskiy, 2021/06/10
[PATCH v3 1/5] block-copy: streamline choice of copy_range vs. read/write, Emanuele Giuseppe Esposito, 2021/06/08
[PATCH v3 3/5] block-copy: move progress_set_remaining in block_copy_task_end,
Emanuele Giuseppe Esposito <=
[PATCH v3 4/5] block-copy: add a CoMutex, Emanuele Giuseppe Esposito, 2021/06/08
[PATCH v3 5/5] block-copy: atomic .cancelled and .finished fields in BlockCopyCallState, Emanuele Giuseppe Esposito, 2021/06/08