]> www.infradead.org Git - users/willy/xarray.git/commit
xfs: only free posteof blocks on first close
authorDarrick J. Wong <djwong@kernel.org>
Tue, 13 Aug 2024 07:39:39 +0000 (09:39 +0200)
committerChandan Babu R <chandanbabu@kernel.org>
Tue, 3 Sep 2024 04:37:38 +0000 (10:07 +0530)
commitf1204d96450fa7650dc27b8839df159a01998737
treeada24ee18b026bbda30070b88d35e3c08d0d0bb6
parent816e3599ca9b9bbfdc456433cc707e75f2c31104
xfs: only free posteof blocks on first close

Certain workloads fragment files on XFS very badly, such as a software
package that creates a number of threads, each of which repeatedly run
the sequence: open a file, perform a synchronous write, and close the
file, which defeats the speculative preallocation mechanism.  We work
around this problem by only deleting posteof blocks the /first/ time a
file is closed to preserve the behavior that unpacking a tarball lays
out files one after the other with no gaps.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
[hch: rebased, updated comment, renamed the flag]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
fs/xfs/xfs_file.c
fs/xfs/xfs_inode.h