summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2016-10-03 09:11:42 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2016-10-05 16:26:26 -0700
commitf0bc4d134b46607967bda1205ce3226a1bd95f42 (patch)
tree66de3ee88dd2559f99a03e091972936df7a213ca /fs/xfs
parentf86f403794b1446b68afb3c233d4c0bc0e93b654 (diff)
downloadtalos-obmc-linux-f0bc4d134b46607967bda1205ce3226a1bd95f42.tar.gz
talos-obmc-linux-f0bc4d134b46607967bda1205ce3226a1bd95f42.zip
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: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_bmap_util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index f7b3f02ff650..e2f46e645612 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1660,6 +1660,8 @@ xfs_swap_extents(
int taforkblks = 0;
__uint64_t tmp;
int lock_flags;
+ struct xfs_ifork *cowfp;
+ __uint64_t f;
/* XXX: we can't do this with rmap, will fix later */
if (xfs_sb_version_hasrmapbt(&mp->m_sb))
@@ -1873,6 +1875,19 @@ xfs_swap_extents(
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, tip, target_log_flags);
OpenPOWER on IntegriCloud