Skip to content

Commit 72f4d52

Browse files
Christoph Hellwigbrauner
authored andcommitted
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 <hch@lst.de> Link: https://lore.kernel.org/r/20240827065123.1762168-6-hch@lst.de Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 1df1d3b commit 72f4d52

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

fs/xfs/xfs_bmap_util.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,9 @@ xfs_alloc_file_space(
653653
xfs_bmbt_irec_t imaps[1], *imapp;
654654
int error;
655655

656+
if (xfs_is_always_cow_inode(ip))
657+
return 0;
658+
656659
trace_xfs_alloc_file_space(ip);
657660

658661
if (xfs_is_shutdown(mp))

fs/xfs/xfs_file.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -987,11 +987,9 @@ xfs_file_fallocate(
987987
}
988988
}
989989

990-
if (!xfs_is_always_cow_inode(ip)) {
991-
error = xfs_alloc_file_space(ip, offset, len);
992-
if (error)
993-
goto out_unlock;
994-
}
990+
error = xfs_alloc_file_space(ip, offset, len);
991+
if (error)
992+
goto out_unlock;
995993
}
996994

997995
/* Change file size if needed */

0 commit comments

Comments
 (0)