]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: allow inodes to have the realtime and reflink flags
authorDarrick J. Wong <djwong@kernel.org>
Thu, 15 Aug 2024 18:49:31 +0000 (11:49 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 16 Aug 2024 21:54:32 +0000 (14:54 -0700)
Now that we can share blocks between realtime files, allow this
combination.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/scrub/inode.c
fs/xfs/scrub/inode_repair.c
fs/xfs/xfs_ioctl.c

index aee6f69bfc0e2a51ec664a99e7b5650158ee3152..07f3dcb0ee5b639a2348f32ca723e9c02e7a5609 100644 (file)
@@ -742,7 +742,8 @@ xfs_dinode_verify(
                return __this_address;
 
        /* don't let reflink and realtime mix */
-       if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags & XFS_DIFLAG_REALTIME))
+       if ((flags2 & XFS_DIFLAG2_REFLINK) && (flags & XFS_DIFLAG_REALTIME) &&
+           !xfs_has_rtreflink(mp))
                return __this_address;
 
        /* COW extent size hint validation */
index 4aaf422d366ff2612e4ecfc75ad8c47827e263f3..e51a87beb896afa3fd2442432c277db22abaf7d9 100644 (file)
@@ -360,8 +360,9 @@ xchk_inode_flags2(
        if ((flags2 & XFS_DIFLAG2_REFLINK) && !S_ISREG(mode))
                goto bad;
 
-       /* realtime and reflink make no sense, currently */
-       if ((flags & XFS_DIFLAG_REALTIME) && (flags2 & XFS_DIFLAG2_REFLINK))
+       /* realtime and reflink don't always go together */
+       if ((flags & XFS_DIFLAG_REALTIME) && (flags2 & XFS_DIFLAG2_REFLINK) &&
+           !xfs_has_rtreflink(mp))
                goto bad;
 
        /* no bigtime iflag without the bigtime feature */
index 06f2b77e51a263f22d2db34f29b01bef7dcdf044..1d01c9f4e53459c8b2cb9dd2ca221ac73fe7e8ea 100644 (file)
@@ -564,8 +564,6 @@ xrep_dinode_flags(
                flags2 |= XFS_DIFLAG2_REFLINK;
        else
                flags2 &= ~(XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE);
-       if (flags & XFS_DIFLAG_REALTIME)
-               flags2 &= ~XFS_DIFLAG2_REFLINK;
        if (!xfs_has_bigtime(mp))
                flags2 &= ~XFS_DIFLAG2_BIGTIME;
        if (!xfs_has_large_extent_counts(mp))
@@ -1767,10 +1765,6 @@ xrep_inode_flags(
        /* DAX only applies to files and dirs. */
        if (!(S_ISREG(mode) || S_ISDIR(mode)))
                sc->ip->i_diflags2 &= ~XFS_DIFLAG2_DAX;
-
-       /* No reflink files on the realtime device. */
-       if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME)
-               sc->ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK;
 }
 
 /*
index f1daf5e063d6040261b95a74194e9816384e61f5..61d1c01bb286d4a84c993b33aa544d1ab88acdc3 100644 (file)
@@ -539,10 +539,6 @@ xfs_ioctl_setattr_xflags(
                if (mp->m_sb.sb_rblocks == 0 || mp->m_sb.sb_rextsize == 0 ||
                    xfs_extlen_to_rtxmod(mp, ip->i_extsize))
                        return -EINVAL;
-
-               /* Clear reflink if we are actually able to set the rt flag. */
-               if (xfs_is_reflink_inode(ip))
-                       ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK;
        }
 
        /* diflags2 only valid for v3 inodes. */