aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_ail.c
diff options
context:
space:
mode:
authorDonald Douwsma <donaldd@sgi.com>2007-10-11 03:36:05 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 00:44:23 -0500
commit287f3dad14828275d2517c8696ad118c82b9243f (patch)
tree4868d40f6c49984ff84f2957d84a3de160d46d7a /fs/xfs/xfs_trans_ail.c
parent541d7d3c4b31e2b0ac846fe6d2eb5cdbe1353095 (diff)
[XFS] Unwrap AIL_LOCK
SGI-PV: 970382 SGI-Modid: xfs-linux-melb:xfs-kern:29739a Signed-off-by: Donald Douwsma <donaldd@sgi.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans_ail.c')
-rw-r--r--fs/xfs/xfs_trans_ail.c52
1 files changed, 23 insertions, 29 deletions
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 5b2ff59f19cf..2d3c297259c2 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -55,16 +55,15 @@ xfs_trans_tail_ail(
55{ 55{
56 xfs_lsn_t lsn; 56 xfs_lsn_t lsn;
57 xfs_log_item_t *lip; 57 xfs_log_item_t *lip;
58 SPLDECL(s);
59 58
60 AIL_LOCK(mp,s); 59 spin_lock(&mp->m_ail_lock);
61 lip = xfs_ail_min(&(mp->m_ail)); 60 lip = xfs_ail_min(&(mp->m_ail));
62 if (lip == NULL) { 61 if (lip == NULL) {
63 lsn = (xfs_lsn_t)0; 62 lsn = (xfs_lsn_t)0;
64 } else { 63 } else {
65 lsn = lip->li_lsn; 64 lsn = lip->li_lsn;
66 } 65 }
67 AIL_UNLOCK(mp, s); 66 spin_unlock(&mp->m_ail_lock);
68 67
69 return lsn; 68 return lsn;
70} 69}
@@ -89,17 +88,16 @@ xfs_trans_push_ail(
89 int restarts; 88 int restarts;
90 int lock_result; 89 int lock_result;
91 int flush_log; 90 int flush_log;
92 SPLDECL(s);
93 91
94#define XFS_TRANS_PUSH_AIL_RESTARTS 1000 92#define XFS_TRANS_PUSH_AIL_RESTARTS 1000
95 93
96 AIL_LOCK(mp,s); 94 spin_lock(&mp->m_ail_lock);
97 lip = xfs_trans_first_ail(mp, &gen); 95 lip = xfs_trans_first_ail(mp, &gen);
98 if (lip == NULL || XFS_FORCED_SHUTDOWN(mp)) { 96 if (lip == NULL || XFS_FORCED_SHUTDOWN(mp)) {
99 /* 97 /*
100 * Just return if the AIL is empty. 98 * Just return if the AIL is empty.
101 */ 99 */
102 AIL_UNLOCK(mp, s); 100 spin_unlock(&mp->m_ail_lock);
103 return (xfs_lsn_t)0; 101 return (xfs_lsn_t)0;
104 } 102 }
105 103
@@ -112,7 +110,7 @@ xfs_trans_push_ail(
112 * beginning of the list. We'd like not to stop until we've at least 110 * beginning of the list. We'd like not to stop until we've at least
113 * tried to push on everything in the AIL with an LSN less than 111 * tried to push on everything in the AIL with an LSN less than
114 * the given threshold. However, we may give up before that if 112 * the given threshold. However, we may give up before that if
115 * we realize that we've been holding the AIL_LOCK for 'too long', 113 * we realize that we've been holding the AIL lock for 'too long',
116 * blocking interrupts. Currently, too long is < 500us roughly. 114 * blocking interrupts. Currently, too long is < 500us roughly.
117 */ 115 */
118 flush_log = 0; 116 flush_log = 0;
@@ -136,14 +134,14 @@ xfs_trans_push_ail(
136 lock_result = IOP_TRYLOCK(lip); 134 lock_result = IOP_TRYLOCK(lip);
137 switch (lock_result) { 135 switch (lock_result) {
138 case XFS_ITEM_SUCCESS: 136 case XFS_ITEM_SUCCESS:
139 AIL_UNLOCK(mp, s); 137 spin_unlock(&mp->m_ail_lock);
140 XFS_STATS_INC(xs_push_ail_success); 138 XFS_STATS_INC(xs_push_ail_success);
141 IOP_PUSH(lip); 139 IOP_PUSH(lip);
142 AIL_LOCK(mp,s); 140 spin_lock(&mp->m_ail_lock);
143 break; 141 break;
144 142
145 case XFS_ITEM_PUSHBUF: 143 case XFS_ITEM_PUSHBUF:
146 AIL_UNLOCK(mp, s); 144 spin_unlock(&mp->m_ail_lock);
147 XFS_STATS_INC(xs_push_ail_pushbuf); 145 XFS_STATS_INC(xs_push_ail_pushbuf);
148#ifdef XFSRACEDEBUG 146#ifdef XFSRACEDEBUG
149 delay_for_intr(); 147 delay_for_intr();
@@ -152,7 +150,7 @@ xfs_trans_push_ail(
152 ASSERT(lip->li_ops->iop_pushbuf); 150 ASSERT(lip->li_ops->iop_pushbuf);
153 ASSERT(lip); 151 ASSERT(lip);
154 IOP_PUSHBUF(lip); 152 IOP_PUSHBUF(lip);
155 AIL_LOCK(mp,s); 153 spin_lock(&mp->m_ail_lock);
156 break; 154 break;
157 155
158 case XFS_ITEM_PINNED: 156 case XFS_ITEM_PINNED:
@@ -181,7 +179,7 @@ xfs_trans_push_ail(
181 /* 179 /*
182 * Just return if we shut down during the last try. 180 * Just return if we shut down during the last try.
183 */ 181 */
184 AIL_UNLOCK(mp, s); 182 spin_unlock(&mp->m_ail_lock);
185 return (xfs_lsn_t)0; 183 return (xfs_lsn_t)0;
186 } 184 }
187 185
@@ -193,10 +191,10 @@ xfs_trans_push_ail(
193 * push out the log so it will become unpinned and 191 * push out the log so it will become unpinned and
194 * move forward in the AIL. 192 * move forward in the AIL.
195 */ 193 */
196 AIL_UNLOCK(mp, s); 194 spin_unlock(&mp->m_ail_lock);
197 XFS_STATS_INC(xs_push_ail_flush); 195 XFS_STATS_INC(xs_push_ail_flush);
198 xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); 196 xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
199 AIL_LOCK(mp, s); 197 spin_lock(&mp->m_ail_lock);
200 } 198 }
201 199
202 lip = xfs_ail_min(&(mp->m_ail)); 200 lip = xfs_ail_min(&(mp->m_ail));
@@ -206,7 +204,7 @@ xfs_trans_push_ail(
206 lsn = lip->li_lsn; 204 lsn = lip->li_lsn;
207 } 205 }
208 206
209 AIL_UNLOCK(mp, s); 207 spin_unlock(&mp->m_ail_lock);
210 return lsn; 208 return lsn;
211} /* xfs_trans_push_ail */ 209} /* xfs_trans_push_ail */
212 210
@@ -269,15 +267,13 @@ xfs_trans_unlocked_item(
269 * has changed. 267 * has changed.
270 * 268 *
271 * This function must be called with the AIL lock held. The lock 269 * This function must be called with the AIL lock held. The lock
272 * is dropped before returning, so the caller must pass in the 270 * is dropped before returning.
273 * cookie returned by AIL_LOCK.
274 */ 271 */
275void 272void
276xfs_trans_update_ail( 273xfs_trans_update_ail(
277 xfs_mount_t *mp, 274 xfs_mount_t *mp,
278 xfs_log_item_t *lip, 275 xfs_log_item_t *lip,
279 xfs_lsn_t lsn, 276 xfs_lsn_t lsn) __releases(mp->m_ail_lock)
280 unsigned long s) __releases(mp->m_ail_lock)
281{ 277{
282 xfs_ail_entry_t *ailp; 278 xfs_ail_entry_t *ailp;
283 xfs_log_item_t *dlip=NULL; 279 xfs_log_item_t *dlip=NULL;
@@ -300,10 +296,10 @@ xfs_trans_update_ail(
300 296
301 if (mlip == dlip) { 297 if (mlip == dlip) {
302 mlip = xfs_ail_min(&(mp->m_ail)); 298 mlip = xfs_ail_min(&(mp->m_ail));
303 AIL_UNLOCK(mp, s); 299 spin_unlock(&mp->m_ail_lock);
304 xfs_log_move_tail(mp, mlip->li_lsn); 300 xfs_log_move_tail(mp, mlip->li_lsn);
305 } else { 301 } else {
306 AIL_UNLOCK(mp, s); 302 spin_unlock(&mp->m_ail_lock);
307 } 303 }
308 304
309 305
@@ -322,14 +318,12 @@ xfs_trans_update_ail(
322 * has changed. 318 * has changed.
323 * 319 *
324 * This function must be called with the AIL lock held. The lock 320 * This function must be called with the AIL lock held. The lock
325 * is dropped before returning, so the caller must pass in the 321 * is dropped before returning.
326 * cookie returned by AIL_LOCK.
327 */ 322 */
328void 323void
329xfs_trans_delete_ail( 324xfs_trans_delete_ail(
330 xfs_mount_t *mp, 325 xfs_mount_t *mp,
331 xfs_log_item_t *lip, 326 xfs_log_item_t *lip) __releases(mp->m_ail_lock)
332 unsigned long s) __releases(mp->m_ail_lock)
333{ 327{
334 xfs_ail_entry_t *ailp; 328 xfs_ail_entry_t *ailp;
335 xfs_log_item_t *dlip; 329 xfs_log_item_t *dlip;
@@ -348,10 +342,10 @@ xfs_trans_delete_ail(
348 342
349 if (mlip == dlip) { 343 if (mlip == dlip) {
350 mlip = xfs_ail_min(&(mp->m_ail)); 344 mlip = xfs_ail_min(&(mp->m_ail));
351 AIL_UNLOCK(mp, s); 345 spin_unlock(&mp->m_ail_lock);
352 xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0)); 346 xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0));
353 } else { 347 } else {
354 AIL_UNLOCK(mp, s); 348 spin_unlock(&mp->m_ail_lock);
355 } 349 }
356 } 350 }
357 else { 351 else {
@@ -360,12 +354,12 @@ xfs_trans_delete_ail(
360 * serious trouble if we get to this stage. 354 * serious trouble if we get to this stage.
361 */ 355 */
362 if (XFS_FORCED_SHUTDOWN(mp)) 356 if (XFS_FORCED_SHUTDOWN(mp))
363 AIL_UNLOCK(mp, s); 357 spin_unlock(&mp->m_ail_lock);
364 else { 358 else {
365 xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, 359 xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
366 "%s: attempting to delete a log item that is not in the AIL", 360 "%s: attempting to delete a log item that is not in the AIL",
367 __FUNCTION__); 361 __FUNCTION__);
368 AIL_UNLOCK(mp, s); 362 spin_unlock(&mp->m_ail_lock);
369 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 363 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
370 } 364 }
371 } 365 }