kill I_LOCK
[safe/jmp/linux-2.6] / fs / xfs / xfs_utils.c
index 47c45ff..4d88616 100644 (file)
 #include "xfs_utils.h"
 
 
-int
-xfs_dir_lookup_int(
-       xfs_inode_t     *dp,
-       uint            lock_mode,
-       bhv_vname_t     *dentry,
-       xfs_ino_t       *inum,
-       xfs_inode_t     **ipp)
-{
-       int             error;
-
-       xfs_itrace_entry(dp);
-
-       error = xfs_dir_lookup(NULL, dp, VNAME(dentry), VNAMELEN(dentry), inum);
-       if (!error) {
-               /*
-                * Unlock the directory. We do this because we can't
-                * hold the directory lock while doing the vn_get()
-                * in xfs_iget().  Doing so could cause us to hold
-                * a lock while waiting for the inode to finish
-                * being inactive while it's waiting for a log
-                * reservation in the inactive routine.
-                */
-               xfs_iunlock(dp, lock_mode);
-               error = xfs_iget(dp->i_mount, NULL, *inum, 0, 0, ipp, 0);
-               xfs_ilock(dp, lock_mode);
-
-               if (error) {
-                       *ipp = NULL;
-               } else if ((*ipp)->i_d.di_mode == 0) {
-                       /*
-                        * The inode has been freed.  Something is
-                        * wrong so just get out of here.
-                        */
-                       xfs_iunlock(dp, lock_mode);
-                       xfs_iput_new(*ipp, 0);
-                       *ipp = NULL;
-                       xfs_ilock(dp, lock_mode);
-                       error = XFS_ERROR(ENOENT);
-               }
-       }
-       return error;
-}
-
 /*
  * Allocates a new inode from disk and return a pointer to the
  * incore copy. This routine will internally commit the current
@@ -209,12 +166,18 @@ xfs_dir_ialloc(
                        xfs_buf_relse(ialloc_context);
                        if (dqinfo) {
                                tp->t_dqinfo = dqinfo;
-                               XFS_TRANS_FREE_DQINFO(tp->t_mountp, tp);
+                               xfs_trans_free_dqinfo(tp);
                        }
                        *tpp = ntp;
                        *ipp = NULL;
                        return code;
                }
+
+               /*
+                * transaction commit worked ok so we can drop the extra ticket
+                * reference that we gained in xfs_trans_dup()
+                */
+               xfs_log_ticket_put(tp->t_ticket);
                code = xfs_trans_reserve(tp, 0, log_res, 0,
                                         XFS_TRANS_PERM_LOG_RES, log_count);
                /*
@@ -280,7 +243,7 @@ xfs_droplink(
 
        ASSERT (ip->i_d.di_nlink > 0);
        ip->i_d.di_nlink--;
-       drop_nlink(ip->i_vnode);
+       drop_nlink(VFS_I(ip));
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
 
        error = 0;
@@ -310,10 +273,10 @@ xfs_bump_ino_vers2(
 {
        xfs_mount_t     *mp;
 
-       ASSERT(ismrlocked (&ip->i_lock, MR_UPDATE));
-       ASSERT(ip->i_d.di_version == XFS_DINODE_VERSION_1);
+       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
+       ASSERT(ip->i_d.di_version == 1);
 
-       ip->i_d.di_version = XFS_DINODE_VERSION_2;
+       ip->i_d.di_version = 2;
        ip->i_d.di_onlink = 0;
        memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
        mp = tp->t_mountp;
@@ -344,8 +307,8 @@ xfs_bumplink(
 
        ASSERT(ip->i_d.di_nlink > 0);
        ip->i_d.di_nlink++;
-       inc_nlink(ip->i_vnode);
-       if ((ip->i_d.di_version == XFS_DINODE_VERSION_1) &&
+       inc_nlink(VFS_I(ip));
+       if ((ip->i_d.di_version == 1) &&
            (ip->i_d.di_nlink > XFS_MAXLINK_1)) {
                /*
                 * The inode has increased its number of links beyond
@@ -411,7 +374,7 @@ xfs_truncate_file(
 
        /*
         * Follow the normal truncate locking protocol.  Since we
-        * hold the inode in the transaction, we know that it's number
+        * hold the inode in the transaction, we know that its number
         * of references will stay constant.
         */
        xfs_ilock(ip, XFS_ILOCK_EXCL);