summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-12-13 10:26:38 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2022-12-13 10:26:38 -0800
commita45a7db9bc7b9e36f213330dcb13356b86a5633a (patch)
treecfcff3aba4c34a607e983542576b29c9664f9b91 /fs
parent02bf43c7b7f7a19aa59a75f5244f0a3408bace1a (diff)
parenta79168a0c00d710420c1758f6c38df89e12f0763 (diff)
Merge tag 'vfs-6.2-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull vfs remap_range update from Darrick Wong: - Make some minor adjustments to the remap range preparation function to skip file updates when the request length is adjusted downwards to zero. * tag 'vfs-6.2-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: fs/remap_range: avoid spurious writeback on zero length request
Diffstat (limited to 'fs')
-rw-r--r--fs/remap_range.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/remap_range.c b/fs/remap_range.c
index 290743c8d226..41f60477bb41 100644
--- a/fs/remap_range.c
+++ b/fs/remap_range.c
@@ -304,7 +304,7 @@ __generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
/* Check that we don't violate system file offset limits. */
ret = generic_remap_checks(file_in, pos_in, file_out, pos_out, len,
remap_flags);
- if (ret)
+ if (ret || *len == 0)
return ret;
/* Wait for the completion of any pending IOs on both files */
@@ -328,9 +328,6 @@ __generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
if (remap_flags & REMAP_FILE_DEDUP) {
bool is_same = false;
- if (*len == 0)
- return 0;
-
if (!IS_DAX(inode_in))
ret = vfs_dedupe_file_range_compare(file_in, pos_in,
file_out, pos_out, *len, &is_same);
@@ -348,7 +345,7 @@ __generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
ret = generic_remap_check_len(inode_in, inode_out, pos_out, len,
remap_flags);
- if (ret)
+ if (ret || *len == 0)
return ret;
/* If can't alter the file contents, we're done. */