[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 12/24] block/block-copy: move block_copy_task_create down
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[RFC 12/24] block/block-copy: move block_copy_task_create down |
Date: |
Fri, 15 Nov 2019 17:14:32 +0300 |
Simple movement without any change. It's needed for the following
patch, as this function will need to use some staff which is currently
below it.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/block-copy.c | 64 +++++++++++++++++++++++-----------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/block/block-copy.c b/block/block-copy.c
index 0525a9fcd5..4e8c64a45d 100644
--- a/block/block-copy.c
+++ b/block/block-copy.c
@@ -111,38 +111,6 @@ static bool coroutine_fn
block_copy_wait_one(BlockCopyState *s, int64_t start,
return true;
}
-static BlockCopyTask *block_copy_task_create(BlockCopyState *s,
- int64_t offset, int64_t bytes)
-{
- int64_t next_zero;
- BlockCopyTask *task = g_new(BlockCopyTask, 1);
-
- assert(bdrv_dirty_bitmap_get(s->copy_bitmap, offset));
-
- bytes = MIN(bytes, s->copy_size);
- next_zero = bdrv_dirty_bitmap_next_zero(s->copy_bitmap, offset, bytes);
- if (next_zero >= 0) {
- assert(next_zero > offset); /* offset is dirty */
- assert(next_zero < offset + bytes); /* no need to do MIN() */
- bytes = next_zero - offset;
- }
-
- /* region is dirty, so no existent tasks possible in it */
- assert(!block_copy_find_task(s, offset, bytes));
-
- bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes);
-
- *task = (BlockCopyTask) {
- .s = s,
- .offset = offset,
- .bytes = bytes,
- };
- qemu_co_queue_init(&task->wait_queue);
- QLIST_INSERT_HEAD(&s->tasks, task, list);
-
- return task;
-}
-
static void coroutine_fn block_copy_task_shrink(BlockCopyTask *task,
int64_t new_bytes)
{
@@ -348,6 +316,38 @@ out:
return ret;
}
+static BlockCopyTask *block_copy_task_create(BlockCopyState *s,
+ int64_t offset, int64_t bytes)
+{
+ int64_t next_zero;
+ BlockCopyTask *task = g_new(BlockCopyTask, 1);
+
+ assert(bdrv_dirty_bitmap_get(s->copy_bitmap, offset));
+
+ bytes = MIN(bytes, s->copy_size);
+ next_zero = bdrv_dirty_bitmap_next_zero(s->copy_bitmap, offset, bytes);
+ if (next_zero >= 0) {
+ assert(next_zero > offset); /* offset is dirty */
+ assert(next_zero < offset + bytes); /* no need to do MIN() */
+ bytes = next_zero - offset;
+ }
+
+ /* region is dirty, so no existent tasks possible in it */
+ assert(!block_copy_find_task(s, offset, bytes));
+
+ bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes);
+
+ *task = (BlockCopyTask) {
+ .s = s,
+ .offset = offset,
+ .bytes = bytes,
+ };
+ qemu_co_queue_init(&task->wait_queue);
+ QLIST_INSERT_HEAD(&s->tasks, task, list);
+
+ return task;
+}
+
static int block_copy_block_status(BlockCopyState *s, int64_t offset,
int64_t bytes, int64_t *pnum)
{
--
2.21.0
- [RFC 00/24] backup performance: block_status + async, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 20/24] job: call job_enter from job_user_pause, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 19/24] blockjob: add set_speed to BlockJobDriver, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 16/24] block/block-copy: add max_chunk and max_workers paramters, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 03/24] block/block-copy: factor out block_copy_find_inflight_req, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 12/24] block/block-copy: move block_copy_task_create down,
Vladimir Sementsov-Ogievskiy <=
- [RFC 09/24] block/block-copy: alloc task on each iteration, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 18/24] block/block-copy: add block_copy_cancel, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 23/24] python: add qemu/bench_block_job.py, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 17/24] block/block-copy: add ratelimit to block-copy, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 15/24] block/block-copy: implement block_copy_async, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 14/24] block/block-copy: More explicit call_state, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 08/24] block/block-copy: rename in-flight requests to tasks, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 02/24] block/block-copy: use block_status, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 06/24] block/block-copy: reduce intersecting request lock, Vladimir Sementsov-Ogievskiy, 2019/11/15
- [RFC 13/24] block/block-copy: use aio-task-pool API, Vladimir Sementsov-Ogievskiy, 2019/11/15