mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-30 22:05:36 +00:00
page-xfer: Splice data into image by chunks
This is needed for the case when the target descriptor is image cache/proxy socket. Signed-off-by: Rodrigo Bruno <rbruno@gsd.inesc-id.pt> Signed-off-by: Katerina Koukiou <k.koukiou@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
86b9170ff3
commit
5afbbe5ce2
@@ -170,15 +170,17 @@ static int write_pages_loc(struct page_xfer *xfer,
|
|||||||
int p, unsigned long len)
|
int p, unsigned long len)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
ssize_t curr = 0;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
ret = splice(p, NULL, img_raw_fd(xfer->pi), NULL, len, SPLICE_F_MOVE);
|
ret = splice(p, NULL, img_raw_fd(xfer->pi), NULL, len, SPLICE_F_MOVE);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
pr_perror("Unable to spice data");
|
pr_perror("Unable to spice data");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ret != len) {
|
curr += ret;
|
||||||
pr_err("Only %zu of %lu bytes have been spliced\n", ret, len);
|
if (curr == len)
|
||||||
return -1;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user