Commit f0bc4d13 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: swap inode reflink flags when swapping inode extents

When we're swapping the extents of two inodes, be sure to swap the
reflink inode flag too.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent f86f4037
...@@ -1660,6 +1660,8 @@ xfs_swap_extents( ...@@ -1660,6 +1660,8 @@ xfs_swap_extents(
int taforkblks = 0; int taforkblks = 0;
__uint64_t tmp; __uint64_t tmp;
int lock_flags; int lock_flags;
struct xfs_ifork *cowfp;
__uint64_t f;
/* XXX: we can't do this with rmap, will fix later */ /* XXX: we can't do this with rmap, will fix later */
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) if (xfs_sb_version_hasrmapbt(&mp->m_sb))
...@@ -1873,6 +1875,19 @@ xfs_swap_extents( ...@@ -1873,6 +1875,19 @@ xfs_swap_extents(
break; break;
} }
/* Do we have to swap reflink flags? */
if ((ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK) ^
(tip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK)) {
f = ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
ip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK;
ip->i_d.di_flags2 |= tip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
tip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK;
tip->i_d.di_flags2 |= f & XFS_DIFLAG2_REFLINK;
cowfp = ip->i_cowfp;
ip->i_cowfp = tip->i_cowfp;
tip->i_cowfp = cowfp;
}
xfs_trans_log_inode(tp, ip, src_log_flags); xfs_trans_log_inode(tp, ip, src_log_flags);
xfs_trans_log_inode(tp, tip, target_log_flags); xfs_trans_log_inode(tp, tip, target_log_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment