aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@sandeen.net>2007-10-11 03:37:31 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-07 00:44:41 -0500
commitc8b5ea289fed15a7d7a4d6e911987ff16499aed7 (patch)
tree87abfca7086b8d68c1696e9c1557f1d5440e9f32
parentb22cd72c95df0414e0502a0999624d460ba66126 (diff)
[XFS] Unwrap GRANT_LOCK.
Un-obfuscate GRANT_LOCK, remove GRANT_LOCK->mutex_lock->spin_lock macros, call spin_lock directly, remove extraneous cookie holdover from old xfs code, and change lock type to spinlock_t. SGI-PV: 970382 SGI-Modid: xfs-linux-melb:xfs-kern:29741a Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Donald Douwsma <donaldd@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
-rw-r--r--fs/xfs/xfs_log.c74
-rw-r--r--fs/xfs/xfs_log_priv.h5
-rw-r--r--fs/xfs/xfs_vnodeops.c6
3 files changed, 35 insertions, 50 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 5eb82306ef76..f1f1f36876e4 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -761,7 +761,6 @@ xfs_log_move_tail(xfs_mount_t *mp,
761 xlog_ticket_t *tic; 761 xlog_ticket_t *tic;
762 xlog_t *log = mp->m_log; 762 xlog_t *log = mp->m_log;
763 int need_bytes, free_bytes, cycle, bytes; 763 int need_bytes, free_bytes, cycle, bytes;
764 SPLDECL(s);
765 764
766 if (XLOG_FORCED_SHUTDOWN(log)) 765 if (XLOG_FORCED_SHUTDOWN(log))
767 return; 766 return;
@@ -774,7 +773,7 @@ xfs_log_move_tail(xfs_mount_t *mp,
774 spin_unlock(&log->l_icloglock); 773 spin_unlock(&log->l_icloglock);
775 } 774 }
776 775
777 s = GRANT_LOCK(log); 776 spin_lock(&log->l_grant_lock);
778 777
779 /* Also an invalid lsn. 1 implies that we aren't passing in a valid 778 /* Also an invalid lsn. 1 implies that we aren't passing in a valid
780 * tail_lsn. 779 * tail_lsn.
@@ -823,7 +822,7 @@ xfs_log_move_tail(xfs_mount_t *mp,
823 tic = tic->t_next; 822 tic = tic->t_next;
824 } while (tic != log->l_reserve_headq); 823 } while (tic != log->l_reserve_headq);
825 } 824 }
826 GRANT_UNLOCK(log, s); 825 spin_unlock(&log->l_grant_lock);
827} /* xfs_log_move_tail */ 826} /* xfs_log_move_tail */
828 827
829/* 828/*
@@ -879,17 +878,16 @@ xfs_lsn_t
879xlog_assign_tail_lsn(xfs_mount_t *mp) 878xlog_assign_tail_lsn(xfs_mount_t *mp)
880{ 879{
881 xfs_lsn_t tail_lsn; 880 xfs_lsn_t tail_lsn;
882 SPLDECL(s);
883 xlog_t *log = mp->m_log; 881 xlog_t *log = mp->m_log;
884 882
885 tail_lsn = xfs_trans_tail_ail(mp); 883 tail_lsn = xfs_trans_tail_ail(mp);
886 s = GRANT_LOCK(log); 884 spin_lock(&log->l_grant_lock);
887 if (tail_lsn != 0) { 885 if (tail_lsn != 0) {
888 log->l_tail_lsn = tail_lsn; 886 log->l_tail_lsn = tail_lsn;
889 } else { 887 } else {
890 tail_lsn = log->l_tail_lsn = log->l_last_sync_lsn; 888 tail_lsn = log->l_tail_lsn = log->l_last_sync_lsn;
891 } 889 }
892 GRANT_UNLOCK(log, s); 890 spin_unlock(&log->l_grant_lock);
893 891
894 return tail_lsn; 892 return tail_lsn;
895} /* xlog_assign_tail_lsn */ 893} /* xlog_assign_tail_lsn */
@@ -1303,11 +1301,10 @@ xlog_grant_push_ail(xfs_mount_t *mp,
1303 int threshold_block; /* block in lsn we'd like to be at */ 1301 int threshold_block; /* block in lsn we'd like to be at */
1304 int threshold_cycle; /* lsn cycle we'd like to be at */ 1302 int threshold_cycle; /* lsn cycle we'd like to be at */
1305 int free_threshold; 1303 int free_threshold;
1306 SPLDECL(s);
1307 1304
1308 ASSERT(BTOBB(need_bytes) < log->l_logBBsize); 1305 ASSERT(BTOBB(need_bytes) < log->l_logBBsize);
1309 1306
1310 s = GRANT_LOCK(log); 1307 spin_lock(&log->l_grant_lock);
1311 free_bytes = xlog_space_left(log, 1308 free_bytes = xlog_space_left(log,
1312 log->l_grant_reserve_cycle, 1309 log->l_grant_reserve_cycle,
1313 log->l_grant_reserve_bytes); 1310 log->l_grant_reserve_bytes);
@@ -1338,7 +1335,7 @@ xlog_grant_push_ail(xfs_mount_t *mp,
1338 if (XFS_LSN_CMP(threshold_lsn, log->l_last_sync_lsn) > 0) 1335 if (XFS_LSN_CMP(threshold_lsn, log->l_last_sync_lsn) > 0)
1339 threshold_lsn = log->l_last_sync_lsn; 1336 threshold_lsn = log->l_last_sync_lsn;
1340 } 1337 }
1341 GRANT_UNLOCK(log, s); 1338 spin_unlock(&log->l_grant_lock);
1342 1339
1343 /* 1340 /*
1344 * Get the transaction layer to kick the dirty buffers out to 1341 * Get the transaction layer to kick the dirty buffers out to
@@ -1388,7 +1385,6 @@ xlog_sync(xlog_t *log,
1388 int roundoff; /* roundoff to BB or stripe */ 1385 int roundoff; /* roundoff to BB or stripe */
1389 int split = 0; /* split write into two regions */ 1386 int split = 0; /* split write into two regions */
1390 int error; 1387 int error;
1391 SPLDECL(s);
1392 int v2 = XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb); 1388 int v2 = XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb);
1393 1389
1394 XFS_STATS_INC(xs_log_writes); 1390 XFS_STATS_INC(xs_log_writes);
@@ -1413,9 +1409,9 @@ xlog_sync(xlog_t *log,
1413 roundoff < BBTOB(1))); 1409 roundoff < BBTOB(1)));
1414 1410
1415 /* move grant heads by roundoff in sync */ 1411 /* move grant heads by roundoff in sync */
1416 s = GRANT_LOCK(log); 1412 spin_lock(&log->l_grant_lock);
1417 xlog_grant_add_space(log, roundoff); 1413 xlog_grant_add_space(log, roundoff);
1418 GRANT_UNLOCK(log, s); 1414 spin_unlock(&log->l_grant_lock);
1419 1415
1420 /* put cycle number in every block */ 1416 /* put cycle number in every block */
1421 xlog_pack_data(log, iclog, roundoff); 1417 xlog_pack_data(log, iclog, roundoff);
@@ -2084,7 +2080,6 @@ xlog_state_do_callback(
2084 int funcdidcallbacks; /* flag: function did callbacks */ 2080 int funcdidcallbacks; /* flag: function did callbacks */
2085 int repeats; /* for issuing console warnings if 2081 int repeats; /* for issuing console warnings if
2086 * looping too many times */ 2082 * looping too many times */
2087 SPLDECL(s);
2088 2083
2089 spin_lock(&log->l_icloglock); 2084 spin_lock(&log->l_icloglock);
2090 first_iclog = iclog = log->l_iclog; 2085 first_iclog = iclog = log->l_iclog;
@@ -2172,16 +2167,16 @@ xlog_state_do_callback(
2172 spin_unlock(&log->l_icloglock); 2167 spin_unlock(&log->l_icloglock);
2173 2168
2174 /* l_last_sync_lsn field protected by 2169 /* l_last_sync_lsn field protected by
2175 * GRANT_LOCK. Don't worry about iclog's lsn. 2170 * l_grant_lock. Don't worry about iclog's lsn.
2176 * No one else can be here except us. 2171 * No one else can be here except us.
2177 */ 2172 */
2178 s = GRANT_LOCK(log); 2173 spin_lock(&log->l_grant_lock);
2179 ASSERT(XFS_LSN_CMP( 2174 ASSERT(XFS_LSN_CMP(
2180 log->l_last_sync_lsn, 2175 log->l_last_sync_lsn,
2181 INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT) 2176 INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT)
2182 )<=0); 2177 )<=0);
2183 log->l_last_sync_lsn = INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT); 2178 log->l_last_sync_lsn = INT_GET(iclog->ic_header.h_lsn, ARCH_CONVERT);
2184 GRANT_UNLOCK(log, s); 2179 spin_unlock(&log->l_grant_lock);
2185 2180
2186 /* 2181 /*
2187 * Keep processing entries in the callback list 2182 * Keep processing entries in the callback list
@@ -2460,7 +2455,6 @@ xlog_grant_log_space(xlog_t *log,
2460{ 2455{
2461 int free_bytes; 2456 int free_bytes;
2462 int need_bytes; 2457 int need_bytes;
2463 SPLDECL(s);
2464#ifdef DEBUG 2458#ifdef DEBUG
2465 xfs_lsn_t tail_lsn; 2459 xfs_lsn_t tail_lsn;
2466#endif 2460#endif
@@ -2472,7 +2466,7 @@ xlog_grant_log_space(xlog_t *log,
2472#endif 2466#endif
2473 2467
2474 /* Is there space or do we need to sleep? */ 2468 /* Is there space or do we need to sleep? */
2475 s = GRANT_LOCK(log); 2469 spin_lock(&log->l_grant_lock);
2476 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: enter"); 2470 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: enter");
2477 2471
2478 /* something is already sleeping; insert new transaction at end */ 2472 /* something is already sleeping; insert new transaction at end */
@@ -2495,7 +2489,7 @@ xlog_grant_log_space(xlog_t *log,
2495 */ 2489 */
2496 xlog_trace_loggrant(log, tic, 2490 xlog_trace_loggrant(log, tic,
2497 "xlog_grant_log_space: wake 1"); 2491 "xlog_grant_log_space: wake 1");
2498 s = GRANT_LOCK(log); 2492 spin_lock(&log->l_grant_lock);
2499 } 2493 }
2500 if (tic->t_flags & XFS_LOG_PERM_RESERV) 2494 if (tic->t_flags & XFS_LOG_PERM_RESERV)
2501 need_bytes = tic->t_unit_res*tic->t_ocnt; 2495 need_bytes = tic->t_unit_res*tic->t_ocnt;
@@ -2517,14 +2511,14 @@ redo:
2517 sv_wait(&tic->t_sema, PINOD|PLTWAIT, &log->l_grant_lock, s); 2511 sv_wait(&tic->t_sema, PINOD|PLTWAIT, &log->l_grant_lock, s);
2518 2512
2519 if (XLOG_FORCED_SHUTDOWN(log)) { 2513 if (XLOG_FORCED_SHUTDOWN(log)) {
2520 s = GRANT_LOCK(log); 2514 spin_lock(&log->l_grant_lock);
2521 goto error_return; 2515 goto error_return;
2522 } 2516 }
2523 2517
2524 xlog_trace_loggrant(log, tic, 2518 xlog_trace_loggrant(log, tic,
2525 "xlog_grant_log_space: wake 2"); 2519 "xlog_grant_log_space: wake 2");
2526 xlog_grant_push_ail(log->l_mp, need_bytes); 2520 xlog_grant_push_ail(log->l_mp, need_bytes);
2527 s = GRANT_LOCK(log); 2521 spin_lock(&log->l_grant_lock);
2528 goto redo; 2522 goto redo;
2529 } else if (tic->t_flags & XLOG_TIC_IN_Q) 2523 } else if (tic->t_flags & XLOG_TIC_IN_Q)
2530 xlog_del_ticketq(&log->l_reserve_headq, tic); 2524 xlog_del_ticketq(&log->l_reserve_headq, tic);
@@ -2546,7 +2540,7 @@ redo:
2546#endif 2540#endif
2547 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: exit"); 2541 xlog_trace_loggrant(log, tic, "xlog_grant_log_space: exit");
2548 xlog_verify_grant_head(log, 1); 2542 xlog_verify_grant_head(log, 1);
2549 GRANT_UNLOCK(log, s); 2543 spin_unlock(&log->l_grant_lock);
2550 return 0; 2544 return 0;
2551 2545
2552 error_return: 2546 error_return:
@@ -2560,7 +2554,7 @@ redo:
2560 */ 2554 */
2561 tic->t_curr_res = 0; 2555 tic->t_curr_res = 0;
2562 tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */ 2556 tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */
2563 GRANT_UNLOCK(log, s); 2557 spin_unlock(&log->l_grant_lock);
2564 return XFS_ERROR(EIO); 2558 return XFS_ERROR(EIO);
2565} /* xlog_grant_log_space */ 2559} /* xlog_grant_log_space */
2566 2560
@@ -2574,7 +2568,6 @@ STATIC int
2574xlog_regrant_write_log_space(xlog_t *log, 2568xlog_regrant_write_log_space(xlog_t *log,
2575 xlog_ticket_t *tic) 2569 xlog_ticket_t *tic)
2576{ 2570{
2577 SPLDECL(s);
2578 int free_bytes, need_bytes; 2571 int free_bytes, need_bytes;
2579 xlog_ticket_t *ntic; 2572 xlog_ticket_t *ntic;
2580#ifdef DEBUG 2573#ifdef DEBUG
@@ -2592,7 +2585,7 @@ xlog_regrant_write_log_space(xlog_t *log,
2592 panic("regrant Recovery problem"); 2585 panic("regrant Recovery problem");
2593#endif 2586#endif
2594 2587
2595 s = GRANT_LOCK(log); 2588 spin_lock(&log->l_grant_lock);
2596 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: enter"); 2589 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: enter");
2597 2590
2598 if (XLOG_FORCED_SHUTDOWN(log)) 2591 if (XLOG_FORCED_SHUTDOWN(log))
@@ -2631,14 +2624,14 @@ xlog_regrant_write_log_space(xlog_t *log,
2631 /* If we're shutting down, this tic is already 2624 /* If we're shutting down, this tic is already
2632 * off the queue */ 2625 * off the queue */
2633 if (XLOG_FORCED_SHUTDOWN(log)) { 2626 if (XLOG_FORCED_SHUTDOWN(log)) {
2634 s = GRANT_LOCK(log); 2627 spin_lock(&log->l_grant_lock);
2635 goto error_return; 2628 goto error_return;
2636 } 2629 }
2637 2630
2638 xlog_trace_loggrant(log, tic, 2631 xlog_trace_loggrant(log, tic,
2639 "xlog_regrant_write_log_space: wake 1"); 2632 "xlog_regrant_write_log_space: wake 1");
2640 xlog_grant_push_ail(log->l_mp, tic->t_unit_res); 2633 xlog_grant_push_ail(log->l_mp, tic->t_unit_res);
2641 s = GRANT_LOCK(log); 2634 spin_lock(&log->l_grant_lock);
2642 } 2635 }
2643 } 2636 }
2644 2637
@@ -2658,14 +2651,14 @@ redo:
2658 2651
2659 /* If we're shutting down, this tic is already off the queue */ 2652 /* If we're shutting down, this tic is already off the queue */
2660 if (XLOG_FORCED_SHUTDOWN(log)) { 2653 if (XLOG_FORCED_SHUTDOWN(log)) {
2661 s = GRANT_LOCK(log); 2654 spin_lock(&log->l_grant_lock);
2662 goto error_return; 2655 goto error_return;
2663 } 2656 }
2664 2657
2665 xlog_trace_loggrant(log, tic, 2658 xlog_trace_loggrant(log, tic,
2666 "xlog_regrant_write_log_space: wake 2"); 2659 "xlog_regrant_write_log_space: wake 2");
2667 xlog_grant_push_ail(log->l_mp, need_bytes); 2660 xlog_grant_push_ail(log->l_mp, need_bytes);
2668 s = GRANT_LOCK(log); 2661 spin_lock(&log->l_grant_lock);
2669 goto redo; 2662 goto redo;
2670 } else if (tic->t_flags & XLOG_TIC_IN_Q) 2663 } else if (tic->t_flags & XLOG_TIC_IN_Q)
2671 xlog_del_ticketq(&log->l_write_headq, tic); 2664 xlog_del_ticketq(&log->l_write_headq, tic);
@@ -2682,7 +2675,7 @@ redo:
2682 2675
2683 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit"); 2676 xlog_trace_loggrant(log, tic, "xlog_regrant_write_log_space: exit");
2684 xlog_verify_grant_head(log, 1); 2677 xlog_verify_grant_head(log, 1);
2685 GRANT_UNLOCK(log, s); 2678 spin_unlock(&log->l_grant_lock);
2686 return 0; 2679 return 0;
2687 2680
2688 2681
@@ -2697,7 +2690,7 @@ redo:
2697 */ 2690 */
2698 tic->t_curr_res = 0; 2691 tic->t_curr_res = 0;
2699 tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */ 2692 tic->t_cnt = 0; /* ungrant will give back unit_res * t_cnt. */
2700 GRANT_UNLOCK(log, s); 2693 spin_unlock(&log->l_grant_lock);
2701 return XFS_ERROR(EIO); 2694 return XFS_ERROR(EIO);
2702} /* xlog_regrant_write_log_space */ 2695} /* xlog_regrant_write_log_space */
2703 2696
@@ -2713,14 +2706,12 @@ STATIC void
2713xlog_regrant_reserve_log_space(xlog_t *log, 2706xlog_regrant_reserve_log_space(xlog_t *log,
2714 xlog_ticket_t *ticket) 2707 xlog_ticket_t *ticket)
2715{ 2708{
2716 SPLDECL(s);
2717
2718 xlog_trace_loggrant(log, ticket, 2709 xlog_trace_loggrant(log, ticket,
2719 "xlog_regrant_reserve_log_space: enter"); 2710 "xlog_regrant_reserve_log_space: enter");
2720 if (ticket->t_cnt > 0) 2711 if (ticket->t_cnt > 0)
2721 ticket->t_cnt--; 2712 ticket->t_cnt--;
2722 2713
2723 s = GRANT_LOCK(log); 2714 spin_lock(&log->l_grant_lock);
2724 xlog_grant_sub_space(log, ticket->t_curr_res); 2715 xlog_grant_sub_space(log, ticket->t_curr_res);
2725 ticket->t_curr_res = ticket->t_unit_res; 2716 ticket->t_curr_res = ticket->t_unit_res;
2726 xlog_tic_reset_res(ticket); 2717 xlog_tic_reset_res(ticket);
@@ -2730,7 +2721,7 @@ xlog_regrant_reserve_log_space(xlog_t *log,
2730 2721
2731 /* just return if we still have some of the pre-reserved space */ 2722 /* just return if we still have some of the pre-reserved space */
2732 if (ticket->t_cnt > 0) { 2723 if (ticket->t_cnt > 0) {
2733 GRANT_UNLOCK(log, s); 2724 spin_unlock(&log->l_grant_lock);
2734 return; 2725 return;
2735 } 2726 }
2736 2727
@@ -2738,7 +2729,7 @@ xlog_regrant_reserve_log_space(xlog_t *log,
2738 xlog_trace_loggrant(log, ticket, 2729 xlog_trace_loggrant(log, ticket,
2739 "xlog_regrant_reserve_log_space: exit"); 2730 "xlog_regrant_reserve_log_space: exit");
2740 xlog_verify_grant_head(log, 0); 2731 xlog_verify_grant_head(log, 0);
2741 GRANT_UNLOCK(log, s); 2732 spin_unlock(&log->l_grant_lock);
2742 ticket->t_curr_res = ticket->t_unit_res; 2733 ticket->t_curr_res = ticket->t_unit_res;
2743 xlog_tic_reset_res(ticket); 2734 xlog_tic_reset_res(ticket);
2744} /* xlog_regrant_reserve_log_space */ 2735} /* xlog_regrant_reserve_log_space */
@@ -2762,12 +2753,10 @@ STATIC void
2762xlog_ungrant_log_space(xlog_t *log, 2753xlog_ungrant_log_space(xlog_t *log,
2763 xlog_ticket_t *ticket) 2754 xlog_ticket_t *ticket)
2764{ 2755{
2765 SPLDECL(s);
2766
2767 if (ticket->t_cnt > 0) 2756 if (ticket->t_cnt > 0)
2768 ticket->t_cnt--; 2757 ticket->t_cnt--;
2769 2758
2770 s = GRANT_LOCK(log); 2759 spin_lock(&log->l_grant_lock);
2771 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: enter"); 2760 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: enter");
2772 2761
2773 xlog_grant_sub_space(log, ticket->t_curr_res); 2762 xlog_grant_sub_space(log, ticket->t_curr_res);
@@ -2784,7 +2773,7 @@ xlog_ungrant_log_space(xlog_t *log,
2784 2773
2785 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: exit"); 2774 xlog_trace_loggrant(log, ticket, "xlog_ungrant_log_space: exit");
2786 xlog_verify_grant_head(log, 1); 2775 xlog_verify_grant_head(log, 1);
2787 GRANT_UNLOCK(log, s); 2776 spin_unlock(&log->l_grant_lock);
2788 xfs_log_move_tail(log->l_mp, 1); 2777 xfs_log_move_tail(log->l_mp, 1);
2789} /* xlog_ungrant_log_space */ 2778} /* xlog_ungrant_log_space */
2790 2779
@@ -3579,7 +3568,6 @@ xfs_log_force_umount(
3579 xlog_t *log; 3568 xlog_t *log;
3580 int retval; 3569 int retval;
3581 int dummy; 3570 int dummy;
3582 SPLDECL(s);
3583 3571
3584 log = mp->m_log; 3572 log = mp->m_log;
3585 3573
@@ -3608,7 +3596,7 @@ xfs_log_force_umount(
3608 * before we mark the filesystem SHUTDOWN and wake 3596 * before we mark the filesystem SHUTDOWN and wake
3609 * everybody up to tell the bad news. 3597 * everybody up to tell the bad news.
3610 */ 3598 */
3611 s = GRANT_LOCK(log); 3599 spin_lock(&log->l_grant_lock);
3612 spin_lock(&log->l_icloglock); 3600 spin_lock(&log->l_icloglock);
3613 mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN; 3601 mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN;
3614 XFS_BUF_DONE(mp->m_sb_bp); 3602 XFS_BUF_DONE(mp->m_sb_bp);
@@ -3648,7 +3636,7 @@ xfs_log_force_umount(
3648 tic = tic->t_next; 3636 tic = tic->t_next;
3649 } while (tic != log->l_write_headq); 3637 } while (tic != log->l_write_headq);
3650 } 3638 }
3651 GRANT_UNLOCK(log, s); 3639 spin_unlock(&log->l_grant_lock);
3652 3640
3653 if (! (log->l_iclog->ic_state & XLOG_STATE_IOERROR)) { 3641 if (! (log->l_iclog->ic_state & XLOG_STATE_IOERROR)) {
3654 ASSERT(!logerror); 3642 ASSERT(!logerror);
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 5fa21b030666..07da6a72628a 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -105,9 +105,6 @@ struct xfs_mount;
105 ((i) >> 24) 105 ((i) >> 24)
106#endif 106#endif
107 107
108#define GRANT_LOCK(log) mutex_spinlock(&(log)->l_grant_lock)
109#define GRANT_UNLOCK(log, s) mutex_spinunlock(&(log)->l_grant_lock, s)
110
111#define xlog_panic(args...) cmn_err(CE_PANIC, ## args) 108#define xlog_panic(args...) cmn_err(CE_PANIC, ## args)
112#define xlog_exit(args...) cmn_err(CE_PANIC, ## args) 109#define xlog_exit(args...) cmn_err(CE_PANIC, ## args)
113#define xlog_warn(args...) cmn_err(CE_WARN, ## args) 110#define xlog_warn(args...) cmn_err(CE_WARN, ## args)
@@ -437,7 +434,7 @@ typedef struct log {
437 char *l_iclog_bak[XLOG_MAX_ICLOGS]; 434 char *l_iclog_bak[XLOG_MAX_ICLOGS];
438 435
439 /* The following block of fields are changed while holding grant_lock */ 436 /* The following block of fields are changed while holding grant_lock */
440 lock_t l_grant_lock; 437 spinlock_t l_grant_lock;
441 xlog_ticket_t *l_reserve_headq; 438 xlog_ticket_t *l_reserve_headq;
442 xlog_ticket_t *l_write_headq; 439 xlog_ticket_t *l_write_headq;
443 int l_grant_reserve_cycle; 440 int l_grant_reserve_cycle;
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index a5cd2dc4c80a..7d3c4a7aa2dc 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -3554,11 +3554,11 @@ xfs_inode_flush(
3554 if (iip && iip->ili_last_lsn) { 3554 if (iip && iip->ili_last_lsn) {
3555 xlog_t *log = mp->m_log; 3555 xlog_t *log = mp->m_log;
3556 xfs_lsn_t sync_lsn; 3556 xfs_lsn_t sync_lsn;
3557 int s, log_flags = XFS_LOG_FORCE; 3557 int log_flags = XFS_LOG_FORCE;
3558 3558
3559 s = GRANT_LOCK(log); 3559 spin_lock(&log->l_grant_lock);
3560 sync_lsn = log->l_last_sync_lsn; 3560 sync_lsn = log->l_last_sync_lsn;
3561 GRANT_UNLOCK(log, s); 3561 spin_unlock(&log->l_grant_lock);
3562 3562
3563 if ((XFS_LSN_CMP(iip->ili_last_lsn, sync_lsn) > 0)) { 3563 if ((XFS_LSN_CMP(iip->ili_last_lsn, sync_lsn) > 0)) {
3564 if (flags & FLUSH_SYNC) 3564 if (flags & FLUSH_SYNC)