Commit 14a7235f authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Ben Myers

xfs: remove log space waitqueues

The tic->t_wait waitqueues can never have more than a single waiter
on them, so we can easily replace them with a task_struct pointer
and wake_up_process.
Reviewed-by: default avatarMark Tinguely <tinguely@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarBen Myers <bpm@sgi.com>
parent cfb7cdca
...@@ -169,7 +169,7 @@ xlog_reserveq_wake( ...@@ -169,7 +169,7 @@ xlog_reserveq_wake(
*free_bytes -= need_bytes; *free_bytes -= need_bytes;
trace_xfs_log_grant_wake_up(log, tic); trace_xfs_log_grant_wake_up(log, tic);
wake_up(&tic->t_wait); wake_up_process(tic->t_task);
} }
return true; return true;
...@@ -193,7 +193,7 @@ xlog_writeq_wake( ...@@ -193,7 +193,7 @@ xlog_writeq_wake(
*free_bytes -= need_bytes; *free_bytes -= need_bytes;
trace_xfs_log_regrant_write_wake_up(log, tic); trace_xfs_log_regrant_write_wake_up(log, tic);
wake_up(&tic->t_wait); wake_up_process(tic->t_task);
} }
return true; return true;
...@@ -212,10 +212,13 @@ xlog_reserveq_wait( ...@@ -212,10 +212,13 @@ xlog_reserveq_wait(
goto shutdown; goto shutdown;
xlog_grant_push_ail(log, need_bytes); xlog_grant_push_ail(log, need_bytes);
__set_current_state(TASK_UNINTERRUPTIBLE);
spin_unlock(&log->l_grant_reserve_lock);
XFS_STATS_INC(xs_sleep_logspace); XFS_STATS_INC(xs_sleep_logspace);
trace_xfs_log_grant_sleep(log, tic);
xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); trace_xfs_log_grant_sleep(log, tic);
schedule();
trace_xfs_log_grant_wake(log, tic); trace_xfs_log_grant_wake(log, tic);
spin_lock(&log->l_grant_reserve_lock); spin_lock(&log->l_grant_reserve_lock);
...@@ -243,10 +246,13 @@ xlog_writeq_wait( ...@@ -243,10 +246,13 @@ xlog_writeq_wait(
goto shutdown; goto shutdown;
xlog_grant_push_ail(log, need_bytes); xlog_grant_push_ail(log, need_bytes);
__set_current_state(TASK_UNINTERRUPTIBLE);
spin_unlock(&log->l_grant_write_lock);
XFS_STATS_INC(xs_sleep_logspace); XFS_STATS_INC(xs_sleep_logspace);
trace_xfs_log_regrant_write_sleep(log, tic);
xlog_wait(&tic->t_wait, &log->l_grant_write_lock); trace_xfs_log_regrant_write_sleep(log, tic);
schedule();
trace_xfs_log_regrant_write_wake(log, tic); trace_xfs_log_regrant_write_wake(log, tic);
spin_lock(&log->l_grant_write_lock); spin_lock(&log->l_grant_write_lock);
...@@ -3276,6 +3282,7 @@ xlog_ticket_alloc( ...@@ -3276,6 +3282,7 @@ xlog_ticket_alloc(
} }
atomic_set(&tic->t_ref, 1); atomic_set(&tic->t_ref, 1);
tic->t_task = current;
INIT_LIST_HEAD(&tic->t_queue); INIT_LIST_HEAD(&tic->t_queue);
tic->t_unit_res = unit_bytes; tic->t_unit_res = unit_bytes;
tic->t_curr_res = unit_bytes; tic->t_curr_res = unit_bytes;
...@@ -3287,7 +3294,6 @@ xlog_ticket_alloc( ...@@ -3287,7 +3294,6 @@ xlog_ticket_alloc(
tic->t_trans_type = 0; tic->t_trans_type = 0;
if (xflags & XFS_LOG_PERM_RESERV) if (xflags & XFS_LOG_PERM_RESERV)
tic->t_flags |= XLOG_TIC_PERM_RESERV; tic->t_flags |= XLOG_TIC_PERM_RESERV;
init_waitqueue_head(&tic->t_wait);
xlog_tic_reset_res(tic); xlog_tic_reset_res(tic);
...@@ -3615,12 +3621,12 @@ xfs_log_force_umount( ...@@ -3615,12 +3621,12 @@ xfs_log_force_umount(
*/ */
spin_lock(&log->l_grant_reserve_lock); spin_lock(&log->l_grant_reserve_lock);
list_for_each_entry(tic, &log->l_reserveq, t_queue) list_for_each_entry(tic, &log->l_reserveq, t_queue)
wake_up(&tic->t_wait); wake_up_process(tic->t_task);
spin_unlock(&log->l_grant_reserve_lock); spin_unlock(&log->l_grant_reserve_lock);
spin_lock(&log->l_grant_write_lock); spin_lock(&log->l_grant_write_lock);
list_for_each_entry(tic, &log->l_writeq, t_queue) list_for_each_entry(tic, &log->l_writeq, t_queue)
wake_up(&tic->t_wait); wake_up_process(tic->t_task);
spin_unlock(&log->l_grant_write_lock); spin_unlock(&log->l_grant_write_lock);
if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) { if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) {
......
...@@ -239,8 +239,8 @@ typedef struct xlog_res { ...@@ -239,8 +239,8 @@ typedef struct xlog_res {
} xlog_res_t; } xlog_res_t;
typedef struct xlog_ticket { typedef struct xlog_ticket {
wait_queue_head_t t_wait; /* ticket wait queue */
struct list_head t_queue; /* reserve/write queue */ struct list_head t_queue; /* reserve/write queue */
struct task_struct *t_task; /* task that owns this ticket */
xlog_tid_t t_tid; /* transaction identifier : 4 */ xlog_tid_t t_tid; /* transaction identifier : 4 */
atomic_t t_ref; /* ticket reference count : 4 */ atomic_t t_ref; /* ticket reference count : 4 */
int t_curr_res; /* current reservation in bytes : 4 */ int t_curr_res; /* current reservation in bytes : 4 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment