38 static int xfs_swap_extents(
50 xfs_inode_t *
ip, *tip;
78 goto out_put_tmp_file;
84 goto out_put_tmp_file;
87 ip = XFS_I(f.
file->f_path.dentry->d_inode);
88 tip = XFS_I(tmp.
file->f_path.dentry->d_inode);
90 if (ip->i_mount != tip->i_mount) {
92 goto out_put_tmp_file;
95 if (ip->i_ino == tip->i_ino) {
97 goto out_put_tmp_file;
100 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
102 goto out_put_tmp_file;
105 error = xfs_swap_extents(ip, tip, sxp);
136 xfs_swap_extents_check_format(
150 if (ip->i_d.di_nextents < tip->i_d.di_nextents)
212 xfs_mount_t *
mp = ip->i_mount;
216 int src_log_flags, target_log_flags;
238 if ((ip->i_d.di_mode &
S_IFMT) != (tip->i_d.di_mode &
S_IFMT)) {
270 trace_xfs_swap_extent_before(ip, 0);
271 trace_xfs_swap_extent_before(tip, 1);
274 error = xfs_swap_extents_check_format(ip, tip);
277 "%s: inode 0x%llx format is incompatible for exchanging.",
278 __func__, ip->i_ino);
335 if ( ((
XFS_IFORK_Q(ip) != 0) && (ip->i_d.di_anextents > 0)) &&
339 goto out_trans_cancel;
341 if ( ((
XFS_IFORK_Q(tip) != 0) && (tip->i_d.di_anextents > 0)) &&
346 goto out_trans_cancel;
361 tmp = (__uint64_t)ip->i_d.di_nblocks;
362 ip->i_d.di_nblocks = tip->i_d.di_nblocks - taforkblks + aforkblks;
363 tip->i_d.di_nblocks = tmp + taforkblks - aforkblks;
365 tmp = (__uint64_t) ip->i_d.di_nextents;
366 ip->i_d.di_nextents = tip->i_d.di_nextents;
367 tip->i_d.di_nextents =
tmp;
369 tmp = (__uint64_t) ip->i_d.di_format;
370 ip->i_d.di_format = tip->i_d.di_format;
371 tip->i_d.di_format = tmp;
382 ASSERT(tip->i_delayed_blks == 0);
383 tip->i_delayed_blks = ip->i_delayed_blks;
384 ip->i_delayed_blks = 0;
387 switch (ip->i_d.di_format) {
405 switch (tip->i_d.di_format) {
433 if (mp->m_flags & XFS_MOUNT_WSYNC)
434 xfs_trans_set_sync(tp);
438 trace_xfs_swap_extent_after(ip, 0);
439 trace_xfs_swap_extent_after(tip, 1);
446 xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);