xfs: use byte ranges for write cleanup ranges
authorDave Chinner <dchinner@redhat.com>
Wed, 23 Nov 2022 01:40:12 +0000 (12:40 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 23 Nov 2022 01:40:12 +0000 (12:40 +1100)
commitb71f889c18ada210a97aa3eb5e00c0de552234c6
tree1d1e345f5a9060de93020e176cccfd5d8e590f48
parent198dd8aedee6a7d2de0dfa739f9a008a938f6848
xfs: use byte ranges for write cleanup ranges

xfs_buffered_write_iomap_end() currently converts the byte ranges
passed to it to filesystem blocks to pass them to the bmap code to
punch out delalloc blocks, but then has to convert filesytem
blocks back to byte ranges for page cache truncate.

We're about to make the page cache truncate go away and replace it
with a page cache walk, so having to convert everything to/from/to
filesystem blocks is messy and error-prone. It is much easier to
pass around byte ranges and convert to page indexes and/or
filesystem blocks only where those units are needed.

In preparation for the page cache walk being added, add a helper
that converts byte ranges to filesystem blocks and calls
xfs_bmap_punch_delalloc_range() and convert
xfs_buffered_write_iomap_end() to calculate limits in byte ranges.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_iomap.c