aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_trans_inode.c')
-rw-r--r--fs/xfs/xfs_trans_inode.c60
1 files changed, 24 insertions, 36 deletions
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index 865eeb63ce16..cdc53a1050c5 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -33,6 +33,7 @@
33#include "xfs_btree.h" 33#include "xfs_btree.h"
34#include "xfs_trans_priv.h" 34#include "xfs_trans_priv.h"
35#include "xfs_inode_item.h" 35#include "xfs_inode_item.h"
36#include "xfs_trace.h"
36 37
37#ifdef XFS_TRANS_DEBUG 38#ifdef XFS_TRANS_DEBUG
38STATIC void 39STATIC void
@@ -42,7 +43,6 @@ xfs_trans_inode_broot_debug(
42#define xfs_trans_inode_broot_debug(ip) 43#define xfs_trans_inode_broot_debug(ip)
43#endif 44#endif
44 45
45
46/* 46/*
47 * Get an inode and join it to the transaction. 47 * Get an inode and join it to the transaction.
48 */ 48 */
@@ -58,32 +58,31 @@ xfs_trans_iget(
58 int error; 58 int error;
59 59
60 error = xfs_iget(mp, tp, ino, flags, lock_flags, ipp); 60 error = xfs_iget(mp, tp, ino, flags, lock_flags, ipp);
61 if (!error && tp) 61 if (!error && tp) {
62 xfs_trans_ijoin(tp, *ipp, lock_flags); 62 xfs_trans_ijoin(tp, *ipp);
63 (*ipp)->i_itemp->ili_lock_flags = lock_flags;
64 }
63 return error; 65 return error;
64} 66}
65 67
66/* 68/*
67 * Add the locked inode to the transaction. 69 * Add a locked inode to the transaction.
68 * The inode must be locked, and it cannot be associated with any 70 *
69 * transaction. The caller must specify the locks already held 71 * The inode must be locked, and it cannot be associated with any transaction.
70 * on the inode.
71 */ 72 */
72void 73void
73xfs_trans_ijoin( 74xfs_trans_ijoin(
74 xfs_trans_t *tp, 75 struct xfs_trans *tp,
75 xfs_inode_t *ip, 76 struct xfs_inode *ip)
76 uint lock_flags)
77{ 77{
78 xfs_inode_log_item_t *iip; 78 xfs_inode_log_item_t *iip;
79 79
80 ASSERT(ip->i_transp == NULL); 80 ASSERT(ip->i_transp == NULL);
81 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 81 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
82 ASSERT(lock_flags & XFS_ILOCK_EXCL);
83 if (ip->i_itemp == NULL) 82 if (ip->i_itemp == NULL)
84 xfs_inode_item_init(ip, ip->i_mount); 83 xfs_inode_item_init(ip, ip->i_mount);
85 iip = ip->i_itemp; 84 iip = ip->i_itemp;
86 ASSERT(iip->ili_flags == 0); 85 ASSERT(iip->ili_lock_flags == 0);
87 86
88 /* 87 /*
89 * Get a log_item_desc to point at the new item. 88 * Get a log_item_desc to point at the new item.
@@ -93,42 +92,31 @@ xfs_trans_ijoin(
93 xfs_trans_inode_broot_debug(ip); 92 xfs_trans_inode_broot_debug(ip);
94 93
95 /* 94 /*
96 * If the IO lock is already held, mark that in the inode log item.
97 */
98 if (lock_flags & XFS_IOLOCK_EXCL) {
99 iip->ili_flags |= XFS_ILI_IOLOCKED_EXCL;
100 } else if (lock_flags & XFS_IOLOCK_SHARED) {
101 iip->ili_flags |= XFS_ILI_IOLOCKED_SHARED;
102 }
103
104 /*
105 * Initialize i_transp so we can find it with xfs_inode_incore() 95 * Initialize i_transp so we can find it with xfs_inode_incore()
106 * in xfs_trans_iget() above. 96 * in xfs_trans_iget() above.
107 */ 97 */
108 ip->i_transp = tp; 98 ip->i_transp = tp;
109} 99}
110 100
111
112
113/* 101/*
114 * Mark the inode as not needing to be unlocked when the inode item's 102 * Add a locked inode to the transaction.
115 * IOP_UNLOCK() routine is called. The inode must already be locked 103 *
116 * and associated with the given transaction. 104 *
105 * Grabs a reference to the inode which will be dropped when the transaction
106 * is commited. The inode will also be unlocked at that point. The inode
107 * must be locked, and it cannot be associated with any transaction.
117 */ 108 */
118/*ARGSUSED*/
119void 109void
120xfs_trans_ihold( 110xfs_trans_ijoin_ref(
121 xfs_trans_t *tp, 111 struct xfs_trans *tp,
122 xfs_inode_t *ip) 112 struct xfs_inode *ip,
113 uint lock_flags)
123{ 114{
124 ASSERT(ip->i_transp == tp); 115 xfs_trans_ijoin(tp, ip);
125 ASSERT(ip->i_itemp != NULL); 116 IHOLD(ip);
126 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 117 ip->i_itemp->ili_lock_flags = lock_flags;
127
128 ip->i_itemp->ili_flags |= XFS_ILI_HOLD;
129} 118}
130 119
131
132/* 120/*
133 * This is called to mark the fields indicated in fieldmask as needing 121 * This is called to mark the fields indicated in fieldmask as needing
134 * to be logged when the transaction is committed. The inode must 122 * to be logged when the transaction is committed. The inode must