* [PATCH] xfs_io: Improvements to copy_range return code handling
@ 2016-12-08 18:44 Anna Schumaker
2016-12-08 23:15 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Anna Schumaker @ 2016-12-08 18:44 UTC (permalink / raw)
To: linux-xfs; +Cc: david
If copy_file_range() returns 0, then that means no data was copied. We
should break out of the loop in this case to prevent looping
indefinitely.
Additionally, if an error is returned by copy_file_range() then we need
to print out the string form to be used by error checking tests in
xfstests.
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
io/copy_file_range.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/io/copy_file_range.c b/io/copy_file_range.c
index eddc634..161bdcf 100644
--- a/io/copy_file_range.c
+++ b/io/copy_file_range.c
@@ -49,8 +49,11 @@ copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)
do {
ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0);
- if (ret == -1)
+ if (ret == -1) {
+ fprintf(stderr, _("copy_range: %s\n"), strerror(errno));
return errno;
+ } else if (ret == 0)
+ break;
len -= ret;
} while (len > 0);
--
2.10.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs_io: Improvements to copy_range return code handling
2016-12-08 18:44 [PATCH] xfs_io: Improvements to copy_range return code handling Anna Schumaker
@ 2016-12-08 23:15 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2016-12-08 23:15 UTC (permalink / raw)
To: Anna Schumaker; +Cc: linux-xfs
On Thu, Dec 08, 2016 at 01:44:47PM -0500, Anna Schumaker wrote:
> If copy_file_range() returns 0, then that means no data was copied. We
> should break out of the loop in this case to prevent looping
> indefinitely.
>
> Additionally, if an error is returned by copy_file_range() then we need
> to print out the string form to be used by error checking tests in
> xfstests.
>
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> ---
> io/copy_file_range.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/io/copy_file_range.c b/io/copy_file_range.c
> index eddc634..161bdcf 100644
> --- a/io/copy_file_range.c
> +++ b/io/copy_file_range.c
> @@ -49,8 +49,11 @@ copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len)
>
> do {
> ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0);
> - if (ret == -1)
> + if (ret == -1) {
> + fprintf(stderr, _("copy_range: %s\n"), strerror(errno));
perror("copy_range")?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-08 23:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 18:44 [PATCH] xfs_io: Improvements to copy_range return code handling Anna Schumaker
2016-12-08 23:15 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).