[XFS] Warn on transaction in flight on read-only remount
[safe/jmp/linux-2.6] / fs / xfs / xfs_trans_inode.c
index 7c5894d..23d276a 100644 (file)
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir.h"
 #include "xfs_dir2.h"
 #include "xfs_dmapi.h"
 #include "xfs_mount.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_ialloc_btree.h"
-#include "xfs_dir_sf.h"
 #include "xfs_dir2_sf.h"
 #include "xfs_attr_sf.h"
 #include "xfs_dinode.h"
@@ -87,7 +85,6 @@ xfs_trans_iget(
 {
        int                     error;
        xfs_inode_t             *ip;
-       xfs_inode_log_item_t    *iip;
 
        /*
         * If the transaction pointer is NULL, just call the normal
@@ -113,13 +110,13 @@ xfs_trans_iget(
                 */
                ASSERT(ip->i_itemp != NULL);
                ASSERT(lock_flags & XFS_ILOCK_EXCL);
-               ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
+               ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
                ASSERT((!(lock_flags & XFS_IOLOCK_EXCL)) ||
-                      ismrlocked(&ip->i_iolock, MR_UPDATE));
+                      xfs_isilocked(ip, XFS_IOLOCK_EXCL));
                ASSERT((!(lock_flags & XFS_IOLOCK_EXCL)) ||
                       (ip->i_itemp->ili_flags & XFS_ILI_IOLOCKED_EXCL));
                ASSERT((!(lock_flags & XFS_IOLOCK_SHARED)) ||
-                      ismrlocked(&ip->i_iolock, (MR_UPDATE | MR_ACCESS)));
+                      xfs_isilocked(ip, XFS_IOLOCK_EXCL|XFS_IOLOCK_SHARED));
                ASSERT((!(lock_flags & XFS_IOLOCK_SHARED)) ||
                       (ip->i_itemp->ili_flags & XFS_ILI_IOLOCKED_ANY));
 
@@ -140,34 +137,7 @@ xfs_trans_iget(
        }
        ASSERT(ip != NULL);
 
-       /*
-        * Get a log_item_desc to point at the new item.
-        */
-       if (ip->i_itemp == NULL)
-               xfs_inode_item_init(ip, mp);
-       iip = ip->i_itemp;
-       (void) xfs_trans_add_item(tp, (xfs_log_item_t *)(iip));
-
-       xfs_trans_inode_broot_debug(ip);
-
-       /*
-        * If the IO lock has been acquired, mark that in
-        * the inode log item so we'll know to unlock it
-        * when the transaction commits.
-        */
-       ASSERT(iip->ili_flags == 0);
-       if (lock_flags & XFS_IOLOCK_EXCL) {
-               iip->ili_flags |= XFS_ILI_IOLOCKED_EXCL;
-       } else if (lock_flags & XFS_IOLOCK_SHARED) {
-               iip->ili_flags |= XFS_ILI_IOLOCKED_SHARED;
-       }
-
-       /*
-        * Initialize i_transp so we can find it with xfs_inode_incore()
-        * above.
-        */
-       ip->i_transp = tp;
-
+       xfs_trans_ijoin(tp, ip, lock_flags);
        *ipp = ip;
        return 0;
 }
@@ -187,7 +157,7 @@ xfs_trans_ijoin(
        xfs_inode_log_item_t    *iip;
 
        ASSERT(ip->i_transp == NULL);
-       ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
+       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
        ASSERT(lock_flags & XFS_ILOCK_EXCL);
        if (ip->i_itemp == NULL)
                xfs_inode_item_init(ip, ip->i_mount);
@@ -234,7 +204,7 @@ xfs_trans_ihold(
 {
        ASSERT(ip->i_transp == tp);
        ASSERT(ip->i_itemp != NULL);
-       ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
+       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
        ip->i_itemp->ili_flags |= XFS_ILI_HOLD;
 }
@@ -259,7 +229,7 @@ xfs_trans_log_inode(
 
        ASSERT(ip->i_transp == tp);
        ASSERT(ip->i_itemp != NULL);
-       ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE));
+       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
        lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)(ip->i_itemp));
        ASSERT(lidp != NULL);
@@ -293,7 +263,7 @@ xfs_trans_inode_broot_debug(
        iip = ip->i_itemp;
        if (iip->ili_root_size != 0) {
                ASSERT(iip->ili_orig_root != NULL);
-               kmem_free(iip->ili_orig_root, iip->ili_root_size);
+               kmem_free(iip->ili_orig_root);
                iip->ili_root_size = 0;
                iip->ili_orig_root = NULL;
        }