* [PATCH] fs: Perform splice in copy_file_range if SB are not same
@ 2018-04-30 19:14 Goldwyn Rodrigues
0 siblings, 0 replies; only message in thread
From: Goldwyn Rodrigues @ 2018-04-30 19:14 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Goldwyn Rodrigues
While performing copy_file_range(), if superblocks of file_in and
file_out don't match, instead of returning -EXDEV, perform
splice for a fast copy.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
diff --git a/fs/read_write.c b/fs/read_write.c
index c4eabbfc90df..e71270033402 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1575,15 +1575,14 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
(file_out->f_flags & O_APPEND))
return -EBADF;
- /* this could be relaxed once a method supports cross-fs copies */
- if (inode_in->i_sb != inode_out->i_sb)
- return -EXDEV;
-
if (len == 0)
return 0;
file_start_write(file_out);
+ if (inode_in->i_sb != inode_out->i_sb)
+ goto do_splice;
+
/*
* Try cloning first, this is supported by more file systems, and
* more efficient if both clone and copy are supported (e.g. NFS).
@@ -1604,6 +1603,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
goto done;
}
+do_splice:
ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out,
len > MAX_RW_COUNT ? MAX_RW_COUNT : len, 0);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-04-30 19:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 19:14 [PATCH] fs: Perform splice in copy_file_range if SB are not same Goldwyn Rodrigues
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).