diff options
| author | Darrick J. Wong <[email protected]> | 2024-11-21 00:21:17 +0000 |
|---|---|---|
| committer | Darrick J. Wong <[email protected]> | 2024-12-23 21:06:17 +0000 |
| commit | 155debbe7e627baf6439e75f15856d40ec115c5d (patch) | |
| tree | f0c56ed17b5624e7417421d08ff5dd5aa6ab3691 /fs/xfs/xfs_reflink.c | |
| parent | xfs: fix CoW forks for realtime files (diff) | |
| download | kernel-155debbe7e627baf6439e75f15856d40ec115c5d.tar.gz kernel-155debbe7e627baf6439e75f15856d40ec115c5d.zip | |
xfs: enable realtime reflink
Enable reflink for realtime devices, as long as the realtime allocation
unit is a single fsblock.
Signed-off-by: "Darrick J. Wong" <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
| -rw-r--r-- | fs/xfs/xfs_reflink.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index d9b33e22c176..59f7fc16eb80 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -1822,3 +1822,28 @@ out: trace_xfs_reflink_unshare_error(ip, error, _RET_IP_); return error; } + +/* + * Can we use reflink with this realtime extent size? Note that we don't check + * for rblocks > 0 here because this can be called as part of attaching a new + * rt section. + */ +bool +xfs_reflink_supports_rextsize( + struct xfs_mount *mp, + unsigned int rextsize) +{ + /* reflink on the realtime device requires rtgroups */ + if (!xfs_has_rtgroups(mp)) + return false; + + /* + * Reflink doesn't support rt extent size larger than a single fsblock + * because we would have to perform CoW-around for unaligned write + * requests to guarantee that we always remap entire rt extents. + */ + if (rextsize != 1) + return false; + + return true; +} |
