xfs: set prealloc flag in xfs_alloc_file_space()
authorDave Chinner <dchinner@redhat.com>
Tue, 7 Mar 2023 18:59:15 +0000 (10:59 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:49:00 +0000 (08:49 +0100)
commit79821ab3284ac6830b9625de278a11a166281a97
tree6b3c02ef566b6bc57914e69b188f5154fef03514
parenta881c1ef16f16235e57f307e0d45a4ee48914733
xfs: set prealloc flag in xfs_alloc_file_space()

commit 0b02c8c0d75a738c98c35f02efb36217c170d78c upsream.

Now that we only call xfs_update_prealloc_flags() from
xfs_file_fallocate() in the case where we need to set the
preallocation flag, do this in xfs_alloc_file_space() where we
already have the inode joined into a transaction and get
rid of the call to xfs_update_prealloc_flags() from the fallocate
code.

This also means that we now correctly avoid setting the
XFS_DIFLAG_PREALLOC flag when xfs_is_always_cow_inode() is true, as
these inodes will never have preallocated extents.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Tested-by: Leah Rumancik <leah.rumancik@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_file.c