mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 21:07:43 +00:00
page-server: Merge async and sync read API calls
Now these two look exactly the same and we can have only one call with additional sync/async (flags) arg. Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com> Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
parent
832f3844f6
commit
2cc7e90d5b
@ -57,9 +57,7 @@ extern int check_parent_page_xfer(int fd_type, long id);
|
||||
extern int request_remote_pages(int pid, unsigned long addr, int nr_pages);
|
||||
|
||||
typedef int (*ps_async_read_complete)(int pid, unsigned long vaddr, int nr_pages, void *);
|
||||
extern int page_server_start_async_read(void *buf, int nr_pages,
|
||||
ps_async_read_complete complete, void *priv);
|
||||
extern int page_server_start_sync_read(void *buf, int nr_pages,
|
||||
ps_async_read_complete complete, void *priv);
|
||||
extern int page_server_start_read(void *buf, int nr_pages,
|
||||
ps_async_read_complete complete, void *priv, unsigned flags);
|
||||
|
||||
#endif /* __CR_PAGE_XFER__H__ */
|
||||
|
@ -1069,7 +1069,7 @@ struct ps_async_read {
|
||||
|
||||
static LIST_HEAD(async_reads);
|
||||
|
||||
int page_server_start_async_read(void *buf, int nr_pages,
|
||||
static int page_server_start_async_read(void *buf, int nr_pages,
|
||||
ps_async_read_complete complete, void *priv)
|
||||
{
|
||||
struct ps_async_read *ar;
|
||||
@ -1201,7 +1201,7 @@ static int receive_remote_pages(int len, void *buf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int page_server_start_sync_read(void *buf, int nr,
|
||||
static int page_server_start_sync_read(void *buf, int nr,
|
||||
ps_async_read_complete complete, void *priv)
|
||||
{
|
||||
int ret, pid, new_nr;
|
||||
@ -1223,3 +1223,12 @@ int page_server_start_sync_read(void *buf, int nr,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int page_server_start_read(void *buf, int nr,
|
||||
ps_async_read_complete complete, void *priv, unsigned flags)
|
||||
{
|
||||
if (flags & PR_ASYNC)
|
||||
return page_server_start_async_read(buf, nr, complete, priv);
|
||||
else
|
||||
return page_server_start_sync_read(buf, nr, complete, priv);
|
||||
}
|
||||
|
@ -438,12 +438,10 @@ static int maybe_read_page_remote(struct page_read *pr, unsigned long vaddr,
|
||||
|
||||
/* We always do PR_ASAP mode here (FIXME?) */
|
||||
ret = request_remote_pages(pr->pid, vaddr, nr);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (flags & PR_ASYNC)
|
||||
return page_server_start_async_read(buf, nr, read_page_complete, pr);
|
||||
else
|
||||
return page_server_start_sync_read(buf, nr, read_page_complete, pr);
|
||||
if (!ret)
|
||||
ret = page_server_start_read(buf, nr,
|
||||
read_page_complete, pr, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int read_pagemap_page(struct page_read *pr, unsigned long vaddr, int nr,
|
||||
|
Loading…
x
Reference in New Issue
Block a user