qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 6/6] block/block-copy: use aio-task-pool API
Date: Tue, 28 Apr 2020 12:01:44 +0200	[thread overview]
Message-ID: <74a7f4e6-6c6b-a484-95c6-838f34fb9f22@redhat.com> (raw)
In-Reply-To: <20200325134639.16337-7-vsementsov@virtuozzo.com>


[-- Attachment #1.1: Type: text/plain, Size: 2348 bytes --]

On 25.03.20 14:46, Vladimir Sementsov-Ogievskiy wrote:
> Run block_copy iterations in parallel in aio tasks.
> 
> Changes:
>   - BlockCopyTask becomes aio task structure. Add zeroes field to pass
>     it to block_copy_do_copy
>   - add call state - it's a state of one call of block_copy(), shared
>     between parallel tasks. For now used only to keep information about
>     first error: is it read or not.
>   - convert block_copy_dirty_clusters to aio-task loop.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  block/block-copy.c | 104 +++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 91 insertions(+), 13 deletions(-)

Looks good, just some nits:

> diff --git a/block/block-copy.c b/block/block-copy.c
> index 910947cb43..9994598eb7 100644
> --- a/block/block-copy.c
> +++ b/block/block-copy.c

[...]

> @@ -225,6 +237,30 @@ void block_copy_set_progress_meter(BlockCopyState *s, ProgressMeter *pm)
>      s->progress = pm;
>  }
>  
> +/* Takes ownership on @task */

*of

> +static coroutine_fn int block_copy_task_run(AioTaskPool *pool,
> +                                            BlockCopyTask *task)
> +{
> +    if (!pool) {
> +        int ret = task->task.func(&task->task);
> +
> +        g_free(task);
> +        return ret;
> +    }
> +
> +    aio_task_pool_wait_slot(pool);
> +    if (aio_task_pool_status(pool) < 0) {
> +        co_put_to_shres(task->s->mem, task->bytes);
> +        block_copy_task_end(task, -EAGAIN);

Hm, I think -ECANCELED might be better.  Not that it really matters...

> +        g_free(task);
> +        return aio_task_pool_status(pool);

Here, too.  (Here, there’s also the fact that this task doesn’t really
fail because of the same reason that the other task failed, so we should
have our own error code here.)

> +    }
> +
> +    aio_task_pool_start_task(pool, &task->task);
> +
> +    return 0;
> +}
> +
>  /*
>   * block_copy_do_copy
>   *

[...]

> @@ -519,25 +584,38 @@ static int coroutine_fn block_copy_dirty_clusters(BlockCopyState *s,

[...]

> +out:
> +    if (aio) {
> +        aio_task_pool_wait_all(aio);
> +        if (ret == 0) {
> +            ret = aio_task_pool_status(aio);
> +        }
> +        g_free(aio);

aio_task_pool_free()?

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-04-28 10:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-25 13:46 [PATCH v2 0/6] block-copy: use aio-task-pool Vladimir Sementsov-Ogievskiy
2020-03-25 13:46 ` [PATCH v2 1/6] block/block-copy: rename in-flight requests to tasks Vladimir Sementsov-Ogievskiy
2020-04-28  7:30   ` Max Reitz
2020-04-28  9:18     ` Vladimir Sementsov-Ogievskiy
2020-03-25 13:46 ` [PATCH v2 2/6] block/block-copy: alloc task on each iteration Vladimir Sementsov-Ogievskiy
2020-04-28  7:44   ` Max Reitz
2020-03-25 13:46 ` [PATCH v2 3/6] block/block-copy: add state pointer to BlockCopyTask Vladimir Sementsov-Ogievskiy
2020-04-28  8:14   ` Max Reitz
2020-03-25 13:46 ` [PATCH v2 4/6] block/block-copy: move task size initial calculation to _task_create Vladimir Sementsov-Ogievskiy
2020-04-28  8:52   ` Max Reitz
2020-04-28  9:28     ` Vladimir Sementsov-Ogievskiy
2020-03-25 13:46 ` [PATCH v2 5/6] block/block-copy: move block_copy_task_create down Vladimir Sementsov-Ogievskiy
2020-04-28  9:06   ` Max Reitz
2020-04-28  9:17     ` Vladimir Sementsov-Ogievskiy
2020-04-28 10:05       ` Max Reitz
2020-03-25 13:46 ` [PATCH v2 6/6] block/block-copy: use aio-task-pool API Vladimir Sementsov-Ogievskiy
2020-04-28 10:01   ` Max Reitz [this message]
2020-04-22 14:30 ` [PATCH v2 0/6] block-copy: use aio-task-pool Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74a7f4e6-6c6b-a484-95c6-838f34fb9f22@redhat.com \
    --to=mreitz@redhat.com \
    --cc=den@openvz.org \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).