xfs: reinstate delalloc for RT inodes (if sb_rextsize == 1)
authorChristoph Hellwig <hch@lst.de>
Mon, 22 Apr 2024 11:20:19 +0000 (13:20 +0200)
committerChandan Babu R <chandanbabu@kernel.org>
Mon, 22 Apr 2024 12:30:50 +0000 (18:00 +0530)
commit6a94b1acda7e7262418e23f906c12a2b08b69d12
tree7900dde3de4b401516c40727df3835915fcd8497
parentbd1753d8c42b6bd5d9a81c81d1ce6e3affe3a59f
xfs: reinstate delalloc for RT inodes (if sb_rextsize == 1)

Commit aff3a9edb708 ("xfs: Use preallocation for inodes with extsz
hints") disabled delayed allocation for all inodes with extent size
hints due a data exposure problem.  It turns out we fixed this data
exposure problem since by always creating unwritten extents for
delalloc conversions due to more data exposure problems, but the
writeback path doesn't actually support extent size hints when
converting delalloc these days, which probably isn't a problem given
that people using the hints know what they get.

However due to the way how xfs_get_extsz_hint is implemented, it
always claims an extent size hint for RT inodes even if the RT
extent size is a single FSB.  Due to that the above commit effectively
disabled delalloc support for RT inodes.

Switch xfs_get_extsz_hint to return 0 for this case and work around
that in a few places to reinstate delalloc support for RT inodes on
file systems with an sb_rextsize of 1.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/xfs_inode.c
fs/xfs/xfs_iomap.c
fs/xfs/xfs_iops.c
fs/xfs/xfs_rtalloc.c