diff options
author | Mark Brown <broonie@kernel.org> | 2023-03-13 13:20:45 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-03-13 13:20:45 +0000 |
commit | b9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01 (patch) | |
tree | 1e8f106c57c2934eee422f8ee5e59e73015e2dc4 /fs/xfs/xfs_aops.c | |
parent | 5bd73a162bc881dbb98ff9909dd865286852ee2b (diff) | |
parent | eeac8ede17557680855031c6f305ece2378af326 (diff) | |
download | linux-stable-b9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01.tar.gz linux-stable-b9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01.tar.bz2 linux-stable-b9d0bb8f1c2e5dce9b8a54fb77d1af4aa64a4c01.zip |
Merge tag 'v6.3-rc2' into regulator-6.4 to fix clock related boot issues
Linux 6.3-rc2
Diffstat (limited to 'fs/xfs/xfs_aops.c')
-rw-r--r-- | fs/xfs/xfs_aops.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 41734202796f..2ef78aa1d3f6 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -449,15 +449,17 @@ xfs_prepare_ioend( } /* - * If the page has delalloc blocks on it, we need to punch them out before we - * invalidate the page. If we don't, we leave a stale delalloc mapping on the - * inode that can trip up a later direct I/O read operation on the same region. + * If the folio has delalloc blocks on it, the caller is asking us to punch them + * out. If we don't, we can leave a stale delalloc mapping covered by a clean + * page that needs to be dirtied again before the delalloc mapping can be + * converted. This stale delalloc mapping can trip up a later direct I/O read + * operation on the same region. * - * We prevent this by truncating away the delalloc regions on the page. Because + * We prevent this by truncating away the delalloc regions on the folio. Because * they are delalloc, we can do this without needing a transaction. Indeed - if * we get ENOSPC errors, we have to be able to do this truncation without a - * transaction as there is no space left for block reservation (typically why we - * see a ENOSPC in writeback). + * transaction as there is no space left for block reservation (typically why + * we see a ENOSPC in writeback). */ static void xfs_discard_folio( @@ -475,8 +477,13 @@ xfs_discard_folio( "page discard on page "PTR_FMT", inode 0x%llx, pos %llu.", folio, ip->i_ino, pos); + /* + * The end of the punch range is always the offset of the the first + * byte of the next folio. Hence the end offset is only dependent on the + * folio itself and not the start offset that is passed in. + */ error = xfs_bmap_punch_delalloc_range(ip, pos, - round_up(pos, folio_size(folio))); + folio_pos(folio) + folio_size(folio)); if (error && !xfs_is_shutdown(mp)) xfs_alert(mp, "page discard unable to remove delalloc mapping."); |