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>
This commit is contained in:
Родитель
c32e5f3995
Коммит
8c5c836bd6
|
@ -4852,7 +4852,7 @@ int ocfs2_reflink_remap_range(struct file *file_in,
|
||||||
|
|
||||||
ret = generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out,
|
ret = generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out,
|
||||||
&len, remap_flags);
|
&len, remap_flags);
|
||||||
if (ret <= 0)
|
if (ret < 0 || len == 0)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
/* Lock out changes to the allocation maps and remap. */
|
/* Lock out changes to the allocation maps and remap. */
|
||||||
|
|
|
@ -1848,8 +1848,8 @@ out_error:
|
||||||
* sense, and then flush all dirty data. Caller must ensure that the
|
* sense, and then flush all dirty data. Caller must ensure that the
|
||||||
* inodes have been locked against any other modifications.
|
* inodes have been locked against any other modifications.
|
||||||
*
|
*
|
||||||
* Returns: 0 for "nothing to clone", 1 for "something to clone", or
|
* If there's an error, then the usual negative error code is returned.
|
||||||
* the usual negative error code.
|
* Otherwise returns 0 with *len set to the request length.
|
||||||
*/
|
*/
|
||||||
int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
|
int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
|
||||||
struct file *file_out, loff_t pos_out,
|
struct file *file_out, loff_t pos_out,
|
||||||
|
@ -1945,7 +1945,7 @@ int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(generic_remap_file_range_prep);
|
EXPORT_SYMBOL(generic_remap_file_range_prep);
|
||||||
|
|
||||||
|
|
|
@ -1329,7 +1329,7 @@ xfs_reflink_remap_prep(
|
||||||
|
|
||||||
ret = generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out,
|
ret = generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out,
|
||||||
len, remap_flags);
|
len, remap_flags);
|
||||||
if (ret <= 0)
|
if (ret < 0 || *len == 0)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1409,7 +1409,7 @@ xfs_reflink_remap_range(
|
||||||
/* Prepare and then clone file data. */
|
/* Prepare and then clone file data. */
|
||||||
ret = xfs_reflink_remap_prep(file_in, pos_in, file_out, pos_out,
|
ret = xfs_reflink_remap_prep(file_in, pos_in, file_out, pos_out,
|
||||||
&len, remap_flags);
|
&len, remap_flags);
|
||||||
if (ret <= 0)
|
if (ret < 0 || len == 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);
|
trace_xfs_reflink_remap_range(src, pos_in, len, dest, pos_out);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче