]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/xfs_dfrag.c
[XFS] kill xfs_lock_dir_and_entry
[linux-2.6-omap-h63xx.git] / fs / xfs / xfs_dfrag.c
index 3f53fad356a30a199e11ad761d47cb6b53aa6252..5ce91a00425fd875dffb5d7c0ff87f92595e4004 100644 (file)
@@ -116,7 +116,7 @@ xfs_swapext(
  out_put_file:
        fput(file);
  out_free_sxp:
-       kmem_free(sxp, sizeof(xfs_swapext_t));
+       kmem_free(sxp);
  out:
        return error;
 }
@@ -128,7 +128,6 @@ xfs_swap_extents(
        xfs_swapext_t   *sxp)
 {
        xfs_mount_t     *mp;
-       xfs_inode_t     *ips[2];
        xfs_trans_t     *tp;
        xfs_bstat_t     *sbp = &sxp->sx_stat;
        bhv_vnode_t     *vp, *tvp;
@@ -150,19 +149,10 @@ xfs_swap_extents(
        }
 
        sbp = &sxp->sx_stat;
-       vp = XFS_ITOV(ip);
-       tvp = XFS_ITOV(tip);
-
-       /* Lock in i_ino order */
-       if (ip->i_ino < tip->i_ino) {
-               ips[0] = ip;
-               ips[1] = tip;
-       } else {
-               ips[0] = tip;
-               ips[1] = ip;
-       }
+       vp = VFS_I(ip);
+       tvp = VFS_I(tip);
 
-       xfs_lock_inodes(ips, 2, 0, lock_flags);
+       xfs_lock_two_inodes(ip, tip, lock_flags);
        locked = 1;
 
        /* Verify that both files have the same format */
@@ -265,7 +255,7 @@ xfs_swap_extents(
                locked = 0;
                goto error0;
        }
-       xfs_lock_inodes(ips, 2, 0, XFS_ILOCK_EXCL);
+       xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
 
        /*
         * Count the number of extended attribute blocks
@@ -350,15 +340,11 @@ xfs_swap_extents(
                break;
        }
 
-       /*
-        * Increment vnode ref counts since xfs_trans_commit &
-        * xfs_trans_cancel will both unlock the inodes and
-        * decrement the associated ref counts.
-        */
-       VN_HOLD(vp);
-       VN_HOLD(tvp);
 
+       IHOLD(ip);
        xfs_trans_ijoin(tp, ip, lock_flags);
+
+       IHOLD(tip);
        xfs_trans_ijoin(tp, tip, lock_flags);
 
        xfs_trans_log_inode(tp, ip,  ilf_fields);
@@ -381,6 +367,6 @@ xfs_swap_extents(
                xfs_iunlock(tip, lock_flags);
        }
        if (tempifp != NULL)
-               kmem_free(tempifp, sizeof(xfs_ifork_t));
+               kmem_free(tempifp);
        return error;
 }