From: Christoph Hellwig Date: Tue, 27 Aug 2024 06:50:49 +0000 (+0200) Subject: xfs: move the xfs_is_always_cow_inode check into xfs_alloc_file_space X-Git-Tag: v6.12~487^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=72f4d525709b6450d181fcfcc296d879f3d0b249;p=platform%2Fkernel%2Flinux-amlogic.git xfs: move the xfs_is_always_cow_inode check into xfs_alloc_file_space Move the xfs_is_always_cow_inode check from the caller into xfs_alloc_file_space to prepare for refactoring of xfs_file_fallocate. Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20240827065123.1762168-6-hch@lst.de Reviewed-by: Darrick J. Wong Signed-off-by: Christian Brauner --- diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 187a0dbda24f..e9fdebaa40ea 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -653,6 +653,9 @@ xfs_alloc_file_space( xfs_bmbt_irec_t imaps[1], *imapp; int error; + if (xfs_is_always_cow_inode(ip)) + return 0; + trace_xfs_alloc_file_space(ip); if (xfs_is_shutdown(mp)) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 5b9e49da0601..489bc1b173c2 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -987,11 +987,9 @@ xfs_file_fallocate( } } - if (!xfs_is_always_cow_inode(ip)) { - error = xfs_alloc_file_space(ip, offset, len); - if (error) - goto out_unlock; - } + error = xfs_alloc_file_space(ip, offset, len); + if (error) + goto out_unlock; } /* Change file size if needed */