New VFS code for 6.2:

- Make some minor adjustments to the remap range preparation function to
   skip file updates when the request length is adjusted downwards to
   zero.
 
 Signed-off-by: Darrick J. Wong <djwong@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAmOHiQcACgkQ+H93GTRK
 tOsaSg/+K3s690Q0xBNbRJUsNOmI1xjRuJgwMvUgAkvBpiNfQXb7txClJgmja3Yl
 082BT9rBS9+aUG7RZ/oSkvHlkQyYd8FuZ9HUBb3ykGJD3DSHMo33ldcg1Hkqx3MX
 37xD2VokY2smNfH71SD6AjAdMCb70jpP1jaP2+rf9IIngAoeU/gTKqw+telgjYC1
 dMh3tw7a+rMiOdU0fOREdlwyd0qw4dZuC+pYyCIFxoM/Kc3YOjh1gP/2ujxTQ4o+
 FPnZvyDxuGoJEyOdAoCf+NXMlwX+hVNomG+O2UAiyKBXb9/anlO/xD3P1/4IEW84
 0R9EMLEKYHQKRODGUwh2C3jK6+Zy20Ej/xzDXNByUUlvY98DIfb9OFBgR0VgZ//H
 hHe+PvOEjwpYr6QLBvycDc9nRxxmNzbRx1J2jZnuo2wRxc4aAU3iG4b6G6liBmUn
 mhuycyCciKLD5k1Y0WK+6LkhJp/Ab3Z3L2S6cCnHuJaOjVh6AbMu0CNvw7Y6uxJh
 VPxZEYkqrceymsKYdkzj0i+PTbOYBputjCsJFR9qFMxAyzzFxdxwT/pWgBmWvGOO
 F/3ekcYvQNxu4jpeFEXaujOrJJWD2SRAqTkpA/zrBF6E4FKcA7y1i3QQe8Oh4PUv
 FJDRNxq+uOhGPFxKckDp+x2Te1krmoa875bSdSfxaOfEl0DjqpU=
 =NSDD
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-12-13 10:26:38 -08:00
commit a45a7db9bc
1 changed files with 2 additions and 5 deletions

View File

@ -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. */