vfs: clean up generic_remap_file_range_prep return value

Since the remap prep function can update the length of the remap
request, we can change this function to return the usual return status
instead of the odd behavior it has now.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
此提交包含在:
Darrick J. Wong
2018-10-30 10:42:24 +11:00
提交者 Dave Chinner
父節點 c32e5f3995
當前提交 8c5c836bd6
共有 3 個檔案被更改,包括 6 行新增6 行删除

查看文件

@@ -1329,7 +1329,7 @@ xfs_reflink_remap_prep(
ret = generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out,
len, remap_flags);
if (ret <= 0)
if (ret < 0 || *len == 0)
goto out_unlock;
/*
@@ -1409,7 +1409,7 @@ xfs_reflink_remap_range(
/* Prepare and then clone file data. */
ret = xfs_reflink_remap_prep(file_in, pos_in, file_out, pos_out,
&len, remap_flags);
if (ret <= 0)
if (ret < 0 || len == 0)
return ret;
trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);