]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: enable realtime reflink
authorDarrick J. Wong <djwong@kernel.org>
Thu, 15 Aug 2024 18:49:50 +0000 (11:49 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 16 Aug 2024 21:54:37 +0000 (14:54 -0700)
Enable reflink for realtime devices, sort of.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/xfs_rtalloc.c
fs/xfs/xfs_super.c

index fbefd5a35f274a54165c2c563122b951e3a5f4c3..3da9121a65a9c42d8f76e418bcd7502ed63a6343 100644 (file)
@@ -1238,9 +1238,11 @@ xfs_growfs_rt(
                return -EINVAL;
 
        /* Unsupported realtime features. */
-       if (!xfs_has_rtgroups(mp) && xfs_has_rmapbt(mp))
+       if (!xfs_has_rtgroups(mp) && (xfs_has_rmapbt(mp) || xfs_has_reflink(mp)))
                return -EOPNOTSUPP;
-       if (xfs_has_reflink(mp) || xfs_has_quota(mp))
+       if (xfs_has_quota(mp))
+               return -EOPNOTSUPP;
+       if (xfs_has_reflink(mp) && in->extsize != 1)
                return -EOPNOTSUPP;
 
        error = xfs_sb_validate_fsb_count(&mp->m_sb, in->newblocks);
index febc1df8b6d3639a1acfd4e35d3421aef5851693..43e8b88cb01c7f9096a0b332d64101e6fa8b9eb1 100644 (file)
@@ -1742,14 +1742,27 @@ xfs_fs_fill_super(
        }
 
        if (xfs_has_reflink(mp)) {
-               if (mp->m_sb.sb_rblocks) {
+               /*
+                * Reflink doesn't support rt extent sizes larger than a single
+                * block because we would have to perform unshare-around for
+                * rtext-unaligned write requests.
+                */
+               if (xfs_has_realtime(mp) && mp->m_sb.sb_rextsize != 1) {
                        xfs_alert(mp,
-       "reflink not compatible with realtime device!");
+       "reflink not compatible with realtime extent size %u!",
+                                       mp->m_sb.sb_rextsize);
                        error = -EINVAL;
                        goto out_filestream_unmount;
                }
 
-               if (xfs_globals.always_cow) {
+               /*
+                * always-cow mode is not supported on filesystems with rt
+                * extent sizes larger than a single block because we'd have
+                * to perform write-around for unaligned writes because remap
+                * requests must be aligned to an rt extent.
+                */
+               if (xfs_globals.always_cow &&
+                   (!xfs_has_realtime(mp) || mp->m_sb.sb_rextsize == 1)) {
                        xfs_info(mp, "using DEBUG-only always_cow mode.");
                        mp->m_always_cow = true;
                }