xfs: support returning partial reflink results
Back when the XFS reflink code only supported clone_file_range, we were only able to return zero or negative error codes to userspace. However, now that copy_file_range (which returns bytes copied) can use XFS' clone_file_range, we have the opportunity to return partial results. For example, if userspace sends a 1GB clone request and we run out of space halfway through, we at least can tell userspace that we completed 512M of that request like a regular write. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:

committed by
Dave Chinner

parent
9f04aaffdd
commit
3f68c1f562
@@ -928,14 +928,11 @@ xfs_file_remap_range(
|
||||
loff_t len,
|
||||
unsigned int remap_flags)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
|
||||
return -EINVAL;
|
||||
|
||||
ret = xfs_reflink_remap_range(file_in, pos_in, file_out, pos_out,
|
||||
return xfs_reflink_remap_range(file_in, pos_in, file_out, pos_out,
|
||||
len, remap_flags);
|
||||
return ret < 0 ? ret : len;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
|
Reference in New Issue
Block a user