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 <vsement...@virtuozzo.com> --- 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