mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 21:38:16 +00:00
page-read: Drop get_remote_pages
We already have routines that do send-req, recv-info and recv-page, so no need in yet another one. Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
edf5809f57
commit
275f81bcb5
@ -52,9 +52,6 @@ extern int check_parent_page_xfer(int fd_type, long id);
|
|||||||
* - dump-side page server sends the raw page data
|
* - dump-side page server sends the raw page data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* sync receive of remote pages */
|
|
||||||
extern int get_remote_pages(int pid, unsigned long addr, int nr_pages, void *dest);
|
|
||||||
|
|
||||||
/* async request/receive of remote pages */
|
/* async request/receive of remote pages */
|
||||||
extern int request_remote_pages(int pid, unsigned long addr, int nr_pages);
|
extern int request_remote_pages(int pid, unsigned long addr, int nr_pages);
|
||||||
extern int receive_remote_pages_info(int *nr_pages, unsigned long *addr, int *pid);
|
extern int receive_remote_pages_info(int *nr_pages, unsigned long *addr, int *pid);
|
||||||
|
@ -950,36 +950,6 @@ out:
|
|||||||
return ret ? : status;
|
return ret ? : status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_remote_pages(int pid, unsigned long addr, int nr_pages, void *dest)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
int len = PAGE_SIZE * nr_pages;
|
|
||||||
|
|
||||||
struct page_server_iov pi;
|
|
||||||
|
|
||||||
if (send_psi(page_server_sk, PS_IOV_GET, nr_pages, addr, pid))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
tcp_nodelay(page_server_sk, true);
|
|
||||||
|
|
||||||
ret = recv(page_server_sk, &pi, sizeof(pi), MSG_WAITALL);
|
|
||||||
if (ret != sizeof(pi))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* zero page */
|
|
||||||
if (pi.cmd == PS_IOV_ZERO)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (pi.nr_pages > nr_pages)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
ret = recv(page_server_sk, dest, len, MSG_WAITALL);
|
|
||||||
if (ret != len)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int request_remote_pages(int pid, unsigned long addr, int nr_pages)
|
int request_remote_pages(int pid, unsigned long addr, int nr_pages)
|
||||||
{
|
{
|
||||||
struct page_server_iov pi = {
|
struct page_server_iov pi = {
|
||||||
@ -1008,6 +978,10 @@ int receive_remote_pages_info(int *nr_pages, unsigned long *addr, int *pid)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pi.cmd == PS_IOV_ZERO)
|
||||||
|
pr_warn("Unexpected ZERO page received for %d.%lx\n",
|
||||||
|
(int)pi.dst_id, (unsigned long)pi.vaddr);
|
||||||
|
|
||||||
*nr_pages = pi.nr_pages;
|
*nr_pages = pi.nr_pages;
|
||||||
*addr = pi.vaddr;
|
*addr = pi.vaddr;
|
||||||
*pid = pi.dst_id;
|
*pid = pi.dst_id;
|
||||||
|
@ -414,16 +414,19 @@ static int maybe_read_page_local(struct page_read *pr, unsigned long vaddr,
|
|||||||
static int maybe_read_page_remote(struct page_read *pr, unsigned long vaddr,
|
static int maybe_read_page_remote(struct page_read *pr, unsigned long vaddr,
|
||||||
int nr, void *buf, unsigned flags)
|
int nr, void *buf, unsigned flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, pid;
|
||||||
|
|
||||||
|
ret = request_remote_pages(pr->pid, vaddr, nr);
|
||||||
|
if ((ret < 0) || (flags & PR_ASYNC))
|
||||||
|
return ret;
|
||||||
|
|
||||||
if (flags & PR_ASYNC)
|
|
||||||
/*
|
/*
|
||||||
* Note, that for async remote page_read, the actual
|
* Note, that for async remote page_read, the actual
|
||||||
* transfer happens in the lazy-pages daemon
|
* transfer happens in the lazy-pages daemon
|
||||||
*/
|
*/
|
||||||
ret = request_remote_pages(pr->pid, vaddr, len / PAGE_SIZE);
|
ret = receive_remote_pages_info(&nr, &vaddr, &pid);
|
||||||
else
|
if (ret == 0)
|
||||||
ret = get_remote_pages(pr->pid, vaddr, nr, buf);
|
ret = receive_remote_pages(nr * PAGE_SIZE, buf);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user