vfs: make remap_file_range functions take and return bytes completed
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 29 Oct 2018 23:41:49 +0000 (10:41 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 29 Oct 2018 23:41:49 +0000 (10:41 +1100)
commit42ec3d4c02187a18e27ff94b409ec27234bf2ffd
treec9db04db8187c370718a43e6067af0e5aa944500
parent8dde90bca6fca3736ea20109654bcf6dcf2ecf1d
vfs: make remap_file_range functions take and return bytes completed

Change the remap_file_range functions to take a number of bytes to
operate upon and return the number of bytes they operated on.  This is a
requirement for allowing fs implementations to return short clone/dedupe
results to the user, which will enable us to obey resource limits in a
graceful manner.

A subsequent patch will enable copy_file_range to signal to the
->clone_file_range implementation that it can handle a short length,
which will be returned in the function's return value.  For now the
short return is not implemented anywhere so the behavior won't change --
either copy_file_range manages to clone the entire range or it tries an
alternative.

Neither clone ioctl can take advantage of this, alas.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
18 files changed:
Documentation/filesystems/vfs.txt
fs/btrfs/ctree.h
fs/btrfs/ioctl.c
fs/cifs/cifsfs.c
fs/ioctl.c
fs/nfs/nfs4file.c
fs/nfsd/vfs.c
fs/ocfs2/file.c
fs/ocfs2/refcounttree.c
fs/ocfs2/refcounttree.h
fs/overlayfs/copy_up.c
fs/overlayfs/file.c
fs/read_write.c
fs/xfs/xfs_file.c
fs/xfs/xfs_reflink.c
fs/xfs/xfs_reflink.h
include/linux/fs.h
mm/filemap.c