[CRIU] [PATCH 4/5] page-server: Split the code doing async page-read
Mike Rapoport
mike.rapoport at gmail.com
Wed Jun 14 14:59:13 MSK 2017
One more comment, sorry.
On Wed, Jun 14, 2017 at 01:15:24PM +0300, Pavel Emelyanov wrote:
> This is re-requisite for the next patch.
>
> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> ---
> criu/page-xfer.c | 45 +++++++++++++++++++++++++++++----------------
> 1 file changed, 29 insertions(+), 16 deletions(-)
>
> diff --git a/criu/page-xfer.c b/criu/page-xfer.c
> index dd1c6d0..b4979aa 100644
> --- a/criu/page-xfer.c
> +++ b/criu/page-xfer.c
[ ... ]
> @@ -1127,17 +1128,29 @@ static int page_server_async_read(struct epoll_rfd *f)
>
> ar->rb += ret;
> if (ar->rb < ar->goal)
> - return 0;
> + return 1;
>
> /*
> * IO complete -- notify the caller and drop the request
> */
> BUG_ON(ar->rb > ar->goal);
> - ret = ar->complete((int)ar->pi.dst_id, (unsigned long)ar->pi.vaddr,
> + return ar->complete((int)ar->pi.dst_id, (unsigned long)ar->pi.vaddr,
> (int)ar->pi.nr_pages, ar->priv);
> +}
>
> - list_del(&ar->l);
> - xfree(ar);
> +static int page_server_async_read(struct epoll_rfd *f)
> +{
> + struct ps_async_read *ar;
> + int ret;
> +
> + BUG_ON(list_empty(&async_reads));
> + ar = list_first_entry(&async_reads, struct ps_async_read, l);
> + ret = page_server_read(ar, MSG_DONTWAIT);
> + if (ret == 0) {
> + list_del(&ar->l);
> + xfree(ar);
> + } else if (ret > 0)
> + ret = 0;
if (ret > 0)
return 0;
if (!ret) {
list_del(&ar->l);
xfree(ar);
}
> return ret;
> }
> --
> 2.1.4
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list