From 3929c853dd894fde9de3e01aeedf2a77a742499b Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Tue, 4 Feb 2014 18:29:21 +0400 Subject: [PATCH] page-xfer: print error message if splice failed Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- page-xfer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/page-xfer.c b/page-xfer.c index e56acfc23..605aa2175 100644 --- a/page-xfer.c +++ b/page-xfer.c @@ -473,8 +473,16 @@ static int write_pagemap_loc(struct page_xfer *xfer, static int write_pages_loc(struct page_xfer *xfer, int p, unsigned long len) { - if (splice(p, NULL, xfer->fd_pg, NULL, len, SPLICE_F_MOVE) != len) + ssize_t ret; + ret = splice(p, NULL, xfer->fd_pg, NULL, len, SPLICE_F_MOVE); + if (ret == -1) { + pr_perror("Unable to spice data"); return -1; + } + if (ret != len) { + pr_err("Only %lu of %lu bytes have been spliced\n", ret, len); + return -1; + } return 0; }