diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-02-19 21:31:25 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-02-22 23:19:53 -0500 |
commit | 28496968a6ac37c8b8c44b5156e633c581bb8378 (patch) | |
tree | 4e0c38612e2718e87219e00b7a3152d53393d145 /fs/xfs | |
parent | 14a7235fba4302a82d61150eda92ec90d3ae9cfb (diff) |
xfs: add the xlog_grant_head structure
Add a new data structure to allow sharing code between the log grant and
regrant code.
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_log.c | 112 | ||||
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 23 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_trace.h | 8 |
4 files changed, 74 insertions, 73 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 02a35fba5eae..ad0cac378e9a 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -158,7 +158,7 @@ xlog_reserveq_wake( | |||
158 | struct xlog_ticket *tic; | 158 | struct xlog_ticket *tic; |
159 | int need_bytes; | 159 | int need_bytes; |
160 | 160 | ||
161 | list_for_each_entry(tic, &log->l_reserveq, t_queue) { | 161 | list_for_each_entry(tic, &log->l_reserve_head.waiters, t_queue) { |
162 | if (tic->t_flags & XLOG_TIC_PERM_RESERV) | 162 | if (tic->t_flags & XLOG_TIC_PERM_RESERV) |
163 | need_bytes = tic->t_unit_res * tic->t_cnt; | 163 | need_bytes = tic->t_unit_res * tic->t_cnt; |
164 | else | 164 | else |
@@ -183,7 +183,7 @@ xlog_writeq_wake( | |||
183 | struct xlog_ticket *tic; | 183 | struct xlog_ticket *tic; |
184 | int need_bytes; | 184 | int need_bytes; |
185 | 185 | ||
186 | list_for_each_entry(tic, &log->l_writeq, t_queue) { | 186 | list_for_each_entry(tic, &log->l_write_head.waiters, t_queue) { |
187 | ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV); | 187 | ASSERT(tic->t_flags & XLOG_TIC_PERM_RESERV); |
188 | 188 | ||
189 | need_bytes = tic->t_unit_res; | 189 | need_bytes = tic->t_unit_res; |
@@ -205,7 +205,7 @@ xlog_reserveq_wait( | |||
205 | struct xlog_ticket *tic, | 205 | struct xlog_ticket *tic, |
206 | int need_bytes) | 206 | int need_bytes) |
207 | { | 207 | { |
208 | list_add_tail(&tic->t_queue, &log->l_reserveq); | 208 | list_add_tail(&tic->t_queue, &log->l_reserve_head.waiters); |
209 | 209 | ||
210 | do { | 210 | do { |
211 | if (XLOG_FORCED_SHUTDOWN(log)) | 211 | if (XLOG_FORCED_SHUTDOWN(log)) |
@@ -213,7 +213,7 @@ xlog_reserveq_wait( | |||
213 | xlog_grant_push_ail(log, need_bytes); | 213 | xlog_grant_push_ail(log, need_bytes); |
214 | 214 | ||
215 | __set_current_state(TASK_UNINTERRUPTIBLE); | 215 | __set_current_state(TASK_UNINTERRUPTIBLE); |
216 | spin_unlock(&log->l_grant_reserve_lock); | 216 | spin_unlock(&log->l_reserve_head.lock); |
217 | 217 | ||
218 | XFS_STATS_INC(xs_sleep_logspace); | 218 | XFS_STATS_INC(xs_sleep_logspace); |
219 | 219 | ||
@@ -221,10 +221,10 @@ xlog_reserveq_wait( | |||
221 | schedule(); | 221 | schedule(); |
222 | trace_xfs_log_grant_wake(log, tic); | 222 | trace_xfs_log_grant_wake(log, tic); |
223 | 223 | ||
224 | spin_lock(&log->l_grant_reserve_lock); | 224 | spin_lock(&log->l_reserve_head.lock); |
225 | if (XLOG_FORCED_SHUTDOWN(log)) | 225 | if (XLOG_FORCED_SHUTDOWN(log)) |
226 | goto shutdown; | 226 | goto shutdown; |
227 | } while (xlog_space_left(log, &log->l_grant_reserve_head) < need_bytes); | 227 | } while (xlog_space_left(log, &log->l_reserve_head.grant) < need_bytes); |
228 | 228 | ||
229 | list_del_init(&tic->t_queue); | 229 | list_del_init(&tic->t_queue); |
230 | return 0; | 230 | return 0; |
@@ -239,7 +239,7 @@ xlog_writeq_wait( | |||
239 | struct xlog_ticket *tic, | 239 | struct xlog_ticket *tic, |
240 | int need_bytes) | 240 | int need_bytes) |
241 | { | 241 | { |
242 | list_add_tail(&tic->t_queue, &log->l_writeq); | 242 | list_add_tail(&tic->t_queue, &log->l_write_head.waiters); |
243 | 243 | ||
244 | do { | 244 | do { |
245 | if (XLOG_FORCED_SHUTDOWN(log)) | 245 | if (XLOG_FORCED_SHUTDOWN(log)) |
@@ -247,7 +247,7 @@ xlog_writeq_wait( | |||
247 | xlog_grant_push_ail(log, need_bytes); | 247 | xlog_grant_push_ail(log, need_bytes); |
248 | 248 | ||
249 | __set_current_state(TASK_UNINTERRUPTIBLE); | 249 | __set_current_state(TASK_UNINTERRUPTIBLE); |
250 | spin_unlock(&log->l_grant_write_lock); | 250 | spin_unlock(&log->l_write_head.lock); |
251 | 251 | ||
252 | XFS_STATS_INC(xs_sleep_logspace); | 252 | XFS_STATS_INC(xs_sleep_logspace); |
253 | 253 | ||
@@ -255,10 +255,10 @@ xlog_writeq_wait( | |||
255 | schedule(); | 255 | schedule(); |
256 | trace_xfs_log_regrant_write_wake(log, tic); | 256 | trace_xfs_log_regrant_write_wake(log, tic); |
257 | 257 | ||
258 | spin_lock(&log->l_grant_write_lock); | 258 | spin_lock(&log->l_write_head.lock); |
259 | if (XLOG_FORCED_SHUTDOWN(log)) | 259 | if (XLOG_FORCED_SHUTDOWN(log)) |
260 | goto shutdown; | 260 | goto shutdown; |
261 | } while (xlog_space_left(log, &log->l_grant_write_head) < need_bytes); | 261 | } while (xlog_space_left(log, &log->l_write_head.grant) < need_bytes); |
262 | 262 | ||
263 | list_del_init(&tic->t_queue); | 263 | list_del_init(&tic->t_queue); |
264 | return 0; | 264 | return 0; |
@@ -779,22 +779,22 @@ xfs_log_space_wake( | |||
779 | if (XLOG_FORCED_SHUTDOWN(log)) | 779 | if (XLOG_FORCED_SHUTDOWN(log)) |
780 | return; | 780 | return; |
781 | 781 | ||
782 | if (!list_empty_careful(&log->l_writeq)) { | 782 | if (!list_empty_careful(&log->l_write_head.waiters)) { |
783 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); | 783 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); |
784 | 784 | ||
785 | spin_lock(&log->l_grant_write_lock); | 785 | spin_lock(&log->l_write_head.lock); |
786 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); | 786 | free_bytes = xlog_space_left(log, &log->l_write_head.grant); |
787 | xlog_writeq_wake(log, &free_bytes); | 787 | xlog_writeq_wake(log, &free_bytes); |
788 | spin_unlock(&log->l_grant_write_lock); | 788 | spin_unlock(&log->l_write_head.lock); |
789 | } | 789 | } |
790 | 790 | ||
791 | if (!list_empty_careful(&log->l_reserveq)) { | 791 | if (!list_empty_careful(&log->l_reserve_head.waiters)) { |
792 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); | 792 | ASSERT(!(log->l_flags & XLOG_ACTIVE_RECOVERY)); |
793 | 793 | ||
794 | spin_lock(&log->l_grant_reserve_lock); | 794 | spin_lock(&log->l_reserve_head.lock); |
795 | free_bytes = xlog_space_left(log, &log->l_grant_reserve_head); | 795 | free_bytes = xlog_space_left(log, &log->l_reserve_head.grant); |
796 | xlog_reserveq_wake(log, &free_bytes); | 796 | xlog_reserveq_wake(log, &free_bytes); |
797 | spin_unlock(&log->l_grant_reserve_lock); | 797 | spin_unlock(&log->l_reserve_head.lock); |
798 | } | 798 | } |
799 | } | 799 | } |
800 | 800 | ||
@@ -1070,12 +1070,12 @@ xlog_alloc_log(xfs_mount_t *mp, | |||
1070 | xlog_assign_atomic_lsn(&log->l_tail_lsn, 1, 0); | 1070 | xlog_assign_atomic_lsn(&log->l_tail_lsn, 1, 0); |
1071 | xlog_assign_atomic_lsn(&log->l_last_sync_lsn, 1, 0); | 1071 | xlog_assign_atomic_lsn(&log->l_last_sync_lsn, 1, 0); |
1072 | log->l_curr_cycle = 1; /* 0 is bad since this is initial value */ | 1072 | log->l_curr_cycle = 1; /* 0 is bad since this is initial value */ |
1073 | xlog_assign_grant_head(&log->l_grant_reserve_head, 1, 0); | 1073 | xlog_assign_grant_head(&log->l_reserve_head.grant, 1, 0); |
1074 | xlog_assign_grant_head(&log->l_grant_write_head, 1, 0); | 1074 | xlog_assign_grant_head(&log->l_write_head.grant, 1, 0); |
1075 | INIT_LIST_HEAD(&log->l_reserveq); | 1075 | INIT_LIST_HEAD(&log->l_reserve_head.waiters); |
1076 | INIT_LIST_HEAD(&log->l_writeq); | 1076 | INIT_LIST_HEAD(&log->l_write_head.waiters); |
1077 | spin_lock_init(&log->l_grant_reserve_lock); | 1077 | spin_lock_init(&log->l_reserve_head.lock); |
1078 | spin_lock_init(&log->l_grant_write_lock); | 1078 | spin_lock_init(&log->l_write_head.lock); |
1079 | 1079 | ||
1080 | error = EFSCORRUPTED; | 1080 | error = EFSCORRUPTED; |
1081 | if (xfs_sb_version_hassector(&mp->m_sb)) { | 1081 | if (xfs_sb_version_hassector(&mp->m_sb)) { |
@@ -1250,7 +1250,7 @@ xlog_grant_push_ail( | |||
1250 | 1250 | ||
1251 | ASSERT(BTOBB(need_bytes) < log->l_logBBsize); | 1251 | ASSERT(BTOBB(need_bytes) < log->l_logBBsize); |
1252 | 1252 | ||
1253 | free_bytes = xlog_space_left(log, &log->l_grant_reserve_head); | 1253 | free_bytes = xlog_space_left(log, &log->l_reserve_head.grant); |
1254 | free_blocks = BTOBBT(free_bytes); | 1254 | free_blocks = BTOBBT(free_bytes); |
1255 | 1255 | ||
1256 | /* | 1256 | /* |
@@ -1382,8 +1382,8 @@ xlog_sync(xlog_t *log, | |||
1382 | roundoff < BBTOB(1))); | 1382 | roundoff < BBTOB(1))); |
1383 | 1383 | ||
1384 | /* move grant heads by roundoff in sync */ | 1384 | /* move grant heads by roundoff in sync */ |
1385 | xlog_grant_add_space(log, &log->l_grant_reserve_head, roundoff); | 1385 | xlog_grant_add_space(log, &log->l_reserve_head.grant, roundoff); |
1386 | xlog_grant_add_space(log, &log->l_grant_write_head, roundoff); | 1386 | xlog_grant_add_space(log, &log->l_write_head.grant, roundoff); |
1387 | 1387 | ||
1388 | /* put cycle number in every block */ | 1388 | /* put cycle number in every block */ |
1389 | xlog_pack_data(log, iclog, roundoff); | 1389 | xlog_pack_data(log, iclog, roundoff); |
@@ -2547,8 +2547,8 @@ restart: | |||
2547 | * path. Hence any lock will be globally hot if we take it unconditionally on | 2547 | * path. Hence any lock will be globally hot if we take it unconditionally on |
2548 | * every pass. | 2548 | * every pass. |
2549 | * | 2549 | * |
2550 | * As tickets are only ever moved on and off the reserveq under the | 2550 | * As tickets are only ever moved on and off the l_reserve.waiters under the |
2551 | * l_grant_reserve_lock, we only need to take that lock if we are going to add | 2551 | * l_reserve.lock, we only need to take that lock if we are going to add |
2552 | * the ticket to the queue and sleep. We can avoid taking the lock if the ticket | 2552 | * the ticket to the queue and sleep. We can avoid taking the lock if the ticket |
2553 | * was never added to the reserveq because the t_queue list head will be empty | 2553 | * was never added to the reserveq because the t_queue list head will be empty |
2554 | * and we hold the only reference to it so it can safely be checked unlocked. | 2554 | * and we hold the only reference to it so it can safely be checked unlocked. |
@@ -2574,23 +2574,23 @@ xlog_grant_log_space( | |||
2574 | need_bytes = tic->t_unit_res; | 2574 | need_bytes = tic->t_unit_res; |
2575 | if (tic->t_flags & XFS_LOG_PERM_RESERV) | 2575 | if (tic->t_flags & XFS_LOG_PERM_RESERV) |
2576 | need_bytes *= tic->t_ocnt; | 2576 | need_bytes *= tic->t_ocnt; |
2577 | free_bytes = xlog_space_left(log, &log->l_grant_reserve_head); | 2577 | free_bytes = xlog_space_left(log, &log->l_reserve_head.grant); |
2578 | if (!list_empty_careful(&log->l_reserveq)) { | 2578 | if (!list_empty_careful(&log->l_reserve_head.waiters)) { |
2579 | spin_lock(&log->l_grant_reserve_lock); | 2579 | spin_lock(&log->l_reserve_head.lock); |
2580 | if (!xlog_reserveq_wake(log, &free_bytes) || | 2580 | if (!xlog_reserveq_wake(log, &free_bytes) || |
2581 | free_bytes < need_bytes) | 2581 | free_bytes < need_bytes) |
2582 | error = xlog_reserveq_wait(log, tic, need_bytes); | 2582 | error = xlog_reserveq_wait(log, tic, need_bytes); |
2583 | spin_unlock(&log->l_grant_reserve_lock); | 2583 | spin_unlock(&log->l_reserve_head.lock); |
2584 | } else if (free_bytes < need_bytes) { | 2584 | } else if (free_bytes < need_bytes) { |
2585 | spin_lock(&log->l_grant_reserve_lock); | 2585 | spin_lock(&log->l_reserve_head.lock); |
2586 | error = xlog_reserveq_wait(log, tic, need_bytes); | 2586 | error = xlog_reserveq_wait(log, tic, need_bytes); |
2587 | spin_unlock(&log->l_grant_reserve_lock); | 2587 | spin_unlock(&log->l_reserve_head.lock); |
2588 | } | 2588 | } |
2589 | if (error) | 2589 | if (error) |
2590 | return error; | 2590 | return error; |
2591 | 2591 | ||
2592 | xlog_grant_add_space(log, &log->l_grant_reserve_head, need_bytes); | 2592 | xlog_grant_add_space(log, &log->l_reserve_head.grant, need_bytes); |
2593 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); | 2593 | xlog_grant_add_space(log, &log->l_write_head.grant, need_bytes); |
2594 | trace_xfs_log_grant_exit(log, tic); | 2594 | trace_xfs_log_grant_exit(log, tic); |
2595 | xlog_verify_grant_tail(log); | 2595 | xlog_verify_grant_tail(log); |
2596 | return 0; | 2596 | return 0; |
@@ -2627,23 +2627,23 @@ xlog_regrant_write_log_space( | |||
2627 | * otherwise try to get some space for this transaction. | 2627 | * otherwise try to get some space for this transaction. |
2628 | */ | 2628 | */ |
2629 | need_bytes = tic->t_unit_res; | 2629 | need_bytes = tic->t_unit_res; |
2630 | free_bytes = xlog_space_left(log, &log->l_grant_write_head); | 2630 | free_bytes = xlog_space_left(log, &log->l_write_head.grant); |
2631 | if (!list_empty_careful(&log->l_writeq)) { | 2631 | if (!list_empty_careful(&log->l_write_head.waiters)) { |
2632 | spin_lock(&log->l_grant_write_lock); | 2632 | spin_lock(&log->l_write_head.lock); |
2633 | if (!xlog_writeq_wake(log, &free_bytes) || | 2633 | if (!xlog_writeq_wake(log, &free_bytes) || |
2634 | free_bytes < need_bytes) | 2634 | free_bytes < need_bytes) |
2635 | error = xlog_writeq_wait(log, tic, need_bytes); | 2635 | error = xlog_writeq_wait(log, tic, need_bytes); |
2636 | spin_unlock(&log->l_grant_write_lock); | 2636 | spin_unlock(&log->l_write_head.lock); |
2637 | } else if (free_bytes < need_bytes) { | 2637 | } else if (free_bytes < need_bytes) { |
2638 | spin_lock(&log->l_grant_write_lock); | 2638 | spin_lock(&log->l_write_head.lock); |
2639 | error = xlog_writeq_wait(log, tic, need_bytes); | 2639 | error = xlog_writeq_wait(log, tic, need_bytes); |
2640 | spin_unlock(&log->l_grant_write_lock); | 2640 | spin_unlock(&log->l_write_head.lock); |
2641 | } | 2641 | } |
2642 | 2642 | ||
2643 | if (error) | 2643 | if (error) |
2644 | return error; | 2644 | return error; |
2645 | 2645 | ||
2646 | xlog_grant_add_space(log, &log->l_grant_write_head, need_bytes); | 2646 | xlog_grant_add_space(log, &log->l_write_head.grant, need_bytes); |
2647 | trace_xfs_log_regrant_write_exit(log, tic); | 2647 | trace_xfs_log_regrant_write_exit(log, tic); |
2648 | xlog_verify_grant_tail(log); | 2648 | xlog_verify_grant_tail(log); |
2649 | return 0; | 2649 | return 0; |
@@ -2665,9 +2665,9 @@ xlog_regrant_reserve_log_space(xlog_t *log, | |||
2665 | if (ticket->t_cnt > 0) | 2665 | if (ticket->t_cnt > 0) |
2666 | ticket->t_cnt--; | 2666 | ticket->t_cnt--; |
2667 | 2667 | ||
2668 | xlog_grant_sub_space(log, &log->l_grant_reserve_head, | 2668 | xlog_grant_sub_space(log, &log->l_reserve_head.grant, |
2669 | ticket->t_curr_res); | 2669 | ticket->t_curr_res); |
2670 | xlog_grant_sub_space(log, &log->l_grant_write_head, | 2670 | xlog_grant_sub_space(log, &log->l_write_head.grant, |
2671 | ticket->t_curr_res); | 2671 | ticket->t_curr_res); |
2672 | ticket->t_curr_res = ticket->t_unit_res; | 2672 | ticket->t_curr_res = ticket->t_unit_res; |
2673 | xlog_tic_reset_res(ticket); | 2673 | xlog_tic_reset_res(ticket); |
@@ -2678,7 +2678,7 @@ xlog_regrant_reserve_log_space(xlog_t *log, | |||
2678 | if (ticket->t_cnt > 0) | 2678 | if (ticket->t_cnt > 0) |
2679 | return; | 2679 | return; |
2680 | 2680 | ||
2681 | xlog_grant_add_space(log, &log->l_grant_reserve_head, | 2681 | xlog_grant_add_space(log, &log->l_reserve_head.grant, |
2682 | ticket->t_unit_res); | 2682 | ticket->t_unit_res); |
2683 | 2683 | ||
2684 | trace_xfs_log_regrant_reserve_exit(log, ticket); | 2684 | trace_xfs_log_regrant_reserve_exit(log, ticket); |
@@ -2724,8 +2724,8 @@ xlog_ungrant_log_space(xlog_t *log, | |||
2724 | bytes += ticket->t_unit_res*ticket->t_cnt; | 2724 | bytes += ticket->t_unit_res*ticket->t_cnt; |
2725 | } | 2725 | } |
2726 | 2726 | ||
2727 | xlog_grant_sub_space(log, &log->l_grant_reserve_head, bytes); | 2727 | xlog_grant_sub_space(log, &log->l_reserve_head.grant, bytes); |
2728 | xlog_grant_sub_space(log, &log->l_grant_write_head, bytes); | 2728 | xlog_grant_sub_space(log, &log->l_write_head.grant, bytes); |
2729 | 2729 | ||
2730 | trace_xfs_log_ungrant_exit(log, ticket); | 2730 | trace_xfs_log_ungrant_exit(log, ticket); |
2731 | 2731 | ||
@@ -3349,7 +3349,7 @@ xlog_verify_grant_tail( | |||
3349 | int tail_cycle, tail_blocks; | 3349 | int tail_cycle, tail_blocks; |
3350 | int cycle, space; | 3350 | int cycle, space; |
3351 | 3351 | ||
3352 | xlog_crack_grant_head(&log->l_grant_write_head, &cycle, &space); | 3352 | xlog_crack_grant_head(&log->l_write_head.grant, &cycle, &space); |
3353 | xlog_crack_atomic_lsn(&log->l_tail_lsn, &tail_cycle, &tail_blocks); | 3353 | xlog_crack_atomic_lsn(&log->l_tail_lsn, &tail_cycle, &tail_blocks); |
3354 | if (tail_cycle != cycle) { | 3354 | if (tail_cycle != cycle) { |
3355 | if (cycle - 1 != tail_cycle && | 3355 | if (cycle - 1 != tail_cycle && |
@@ -3619,15 +3619,15 @@ xfs_log_force_umount( | |||
3619 | * we don't enqueue anything once the SHUTDOWN flag is set, and this | 3619 | * we don't enqueue anything once the SHUTDOWN flag is set, and this |
3620 | * action is protected by the grant locks. | 3620 | * action is protected by the grant locks. |
3621 | */ | 3621 | */ |
3622 | spin_lock(&log->l_grant_reserve_lock); | 3622 | spin_lock(&log->l_reserve_head.lock); |
3623 | list_for_each_entry(tic, &log->l_reserveq, t_queue) | 3623 | list_for_each_entry(tic, &log->l_reserve_head.waiters, t_queue) |
3624 | wake_up_process(tic->t_task); | 3624 | wake_up_process(tic->t_task); |
3625 | spin_unlock(&log->l_grant_reserve_lock); | 3625 | spin_unlock(&log->l_reserve_head.lock); |
3626 | 3626 | ||
3627 | spin_lock(&log->l_grant_write_lock); | 3627 | spin_lock(&log->l_write_head.lock); |
3628 | list_for_each_entry(tic, &log->l_writeq, t_queue) | 3628 | list_for_each_entry(tic, &log->l_write_head.waiters, t_queue) |
3629 | wake_up_process(tic->t_task); | 3629 | wake_up_process(tic->t_task); |
3630 | spin_unlock(&log->l_grant_write_lock); | 3630 | spin_unlock(&log->l_write_head.lock); |
3631 | 3631 | ||
3632 | if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) { | 3632 | if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) { |
3633 | ASSERT(!logerror); | 3633 | ASSERT(!logerror); |
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index d8c5e47bbc2f..eba4ec925a45 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -470,6 +470,16 @@ struct xfs_cil { | |||
470 | #define XLOG_CIL_HARD_SPACE_LIMIT(log) (3 * (log->l_logsize >> 4)) | 470 | #define XLOG_CIL_HARD_SPACE_LIMIT(log) (3 * (log->l_logsize >> 4)) |
471 | 471 | ||
472 | /* | 472 | /* |
473 | * ticket grant locks, queues and accounting have their own cachlines | ||
474 | * as these are quite hot and can be operated on concurrently. | ||
475 | */ | ||
476 | struct xlog_grant_head { | ||
477 | spinlock_t lock ____cacheline_aligned_in_smp; | ||
478 | struct list_head waiters; | ||
479 | atomic64_t grant; | ||
480 | }; | ||
481 | |||
482 | /* | ||
473 | * The reservation head lsn is not made up of a cycle number and block number. | 483 | * The reservation head lsn is not made up of a cycle number and block number. |
474 | * Instead, it uses a cycle number and byte number. Logs don't expect to | 484 | * Instead, it uses a cycle number and byte number. Logs don't expect to |
475 | * overflow 31 bits worth of byte offset, so using a byte number will mean | 485 | * overflow 31 bits worth of byte offset, so using a byte number will mean |
@@ -520,17 +530,8 @@ typedef struct log { | |||
520 | /* lsn of 1st LR with unflushed * buffers */ | 530 | /* lsn of 1st LR with unflushed * buffers */ |
521 | atomic64_t l_tail_lsn ____cacheline_aligned_in_smp; | 531 | atomic64_t l_tail_lsn ____cacheline_aligned_in_smp; |
522 | 532 | ||
523 | /* | 533 | struct xlog_grant_head l_reserve_head; |
524 | * ticket grant locks, queues and accounting have their own cachlines | 534 | struct xlog_grant_head l_write_head; |
525 | * as these are quite hot and can be operated on concurrently. | ||
526 | */ | ||
527 | spinlock_t l_grant_reserve_lock ____cacheline_aligned_in_smp; | ||
528 | struct list_head l_reserveq; | ||
529 | atomic64_t l_grant_reserve_head; | ||
530 | |||
531 | spinlock_t l_grant_write_lock ____cacheline_aligned_in_smp; | ||
532 | struct list_head l_writeq; | ||
533 | atomic64_t l_grant_write_head; | ||
534 | 535 | ||
535 | /* The following field are used for debugging; need to hold icloglock */ | 536 | /* The following field are used for debugging; need to hold icloglock */ |
536 | #ifdef DEBUG | 537 | #ifdef DEBUG |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 8a3d8aedd1f4..7c75c7374d5a 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -965,9 +965,9 @@ xlog_find_tail( | |||
965 | log->l_curr_cycle++; | 965 | log->l_curr_cycle++; |
966 | atomic64_set(&log->l_tail_lsn, be64_to_cpu(rhead->h_tail_lsn)); | 966 | atomic64_set(&log->l_tail_lsn, be64_to_cpu(rhead->h_tail_lsn)); |
967 | atomic64_set(&log->l_last_sync_lsn, be64_to_cpu(rhead->h_lsn)); | 967 | atomic64_set(&log->l_last_sync_lsn, be64_to_cpu(rhead->h_lsn)); |
968 | xlog_assign_grant_head(&log->l_grant_reserve_head, log->l_curr_cycle, | 968 | xlog_assign_grant_head(&log->l_reserve_head.grant, log->l_curr_cycle, |
969 | BBTOB(log->l_curr_block)); | 969 | BBTOB(log->l_curr_block)); |
970 | xlog_assign_grant_head(&log->l_grant_write_head, log->l_curr_cycle, | 970 | xlog_assign_grant_head(&log->l_write_head.grant, log->l_curr_cycle, |
971 | BBTOB(log->l_curr_block)); | 971 | BBTOB(log->l_curr_block)); |
972 | 972 | ||
973 | /* | 973 | /* |
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index bb134a819930..a80e30854fce 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h | |||
@@ -782,12 +782,12 @@ DECLARE_EVENT_CLASS(xfs_loggrant_class, | |||
782 | __entry->curr_res = tic->t_curr_res; | 782 | __entry->curr_res = tic->t_curr_res; |
783 | __entry->unit_res = tic->t_unit_res; | 783 | __entry->unit_res = tic->t_unit_res; |
784 | __entry->flags = tic->t_flags; | 784 | __entry->flags = tic->t_flags; |
785 | __entry->reserveq = list_empty(&log->l_reserveq); | 785 | __entry->reserveq = list_empty(&log->l_reserve_head.waiters); |
786 | __entry->writeq = list_empty(&log->l_writeq); | 786 | __entry->writeq = list_empty(&log->l_write_head.waiters); |
787 | xlog_crack_grant_head(&log->l_grant_reserve_head, | 787 | xlog_crack_grant_head(&log->l_reserve_head.grant, |
788 | &__entry->grant_reserve_cycle, | 788 | &__entry->grant_reserve_cycle, |
789 | &__entry->grant_reserve_bytes); | 789 | &__entry->grant_reserve_bytes); |
790 | xlog_crack_grant_head(&log->l_grant_write_head, | 790 | xlog_crack_grant_head(&log->l_write_head.grant, |
791 | &__entry->grant_write_cycle, | 791 | &__entry->grant_write_cycle, |
792 | &__entry->grant_write_bytes); | 792 | &__entry->grant_write_bytes); |
793 | __entry->curr_cycle = log->l_curr_cycle; | 793 | __entry->curr_cycle = log->l_curr_cycle; |