aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-02-19 21:31:24 -0500
committerBen Myers <bpm@sgi.com>2012-02-22 23:17:00 -0500
commit14a7235fba4302a82d61150eda92ec90d3ae9cfb (patch)
treee0a43b6367bef41f68137279552caf7b53a43010 /fs/xfs
parentcfb7cdca0aca5ee2e2ef491284bf1edc3b581885 (diff)
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: 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.c24
-rw-r--r--fs/xfs/xfs_log_priv.h2
2 files changed, 16 insertions, 10 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 2db39df5a57d..02a35fba5eae 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -169,7 +169,7 @@ xlog_reserveq_wake(
169 *free_bytes -= need_bytes; 169 *free_bytes -= need_bytes;
170 170
171 trace_xfs_log_grant_wake_up(log, tic); 171 trace_xfs_log_grant_wake_up(log, tic);
172 wake_up(&tic->t_wait); 172 wake_up_process(tic->t_task);
173 } 173 }
174 174
175 return true; 175 return true;
@@ -193,7 +193,7 @@ xlog_writeq_wake(
193 *free_bytes -= need_bytes; 193 *free_bytes -= need_bytes;
194 194
195 trace_xfs_log_regrant_write_wake_up(log, tic); 195 trace_xfs_log_regrant_write_wake_up(log, tic);
196 wake_up(&tic->t_wait); 196 wake_up_process(tic->t_task);
197 } 197 }
198 198
199 return true; 199 return true;
@@ -212,10 +212,13 @@ xlog_reserveq_wait(
212 goto shutdown; 212 goto shutdown;
213 xlog_grant_push_ail(log, need_bytes); 213 xlog_grant_push_ail(log, need_bytes);
214 214
215 __set_current_state(TASK_UNINTERRUPTIBLE);
216 spin_unlock(&log->l_grant_reserve_lock);
217
215 XFS_STATS_INC(xs_sleep_logspace); 218 XFS_STATS_INC(xs_sleep_logspace);
216 trace_xfs_log_grant_sleep(log, tic);
217 219
218 xlog_wait(&tic->t_wait, &log->l_grant_reserve_lock); 220 trace_xfs_log_grant_sleep(log, tic);
221 schedule();
219 trace_xfs_log_grant_wake(log, tic); 222 trace_xfs_log_grant_wake(log, tic);
220 223
221 spin_lock(&log->l_grant_reserve_lock); 224 spin_lock(&log->l_grant_reserve_lock);
@@ -243,10 +246,13 @@ xlog_writeq_wait(
243 goto shutdown; 246 goto shutdown;
244 xlog_grant_push_ail(log, need_bytes); 247 xlog_grant_push_ail(log, need_bytes);
245 248
249 __set_current_state(TASK_UNINTERRUPTIBLE);
250 spin_unlock(&log->l_grant_write_lock);
251
246 XFS_STATS_INC(xs_sleep_logspace); 252 XFS_STATS_INC(xs_sleep_logspace);
247 trace_xfs_log_regrant_write_sleep(log, tic);
248 253
249 xlog_wait(&tic->t_wait, &log->l_grant_write_lock); 254 trace_xfs_log_regrant_write_sleep(log, tic);
255 schedule();
250 trace_xfs_log_regrant_write_wake(log, tic); 256 trace_xfs_log_regrant_write_wake(log, tic);
251 257
252 spin_lock(&log->l_grant_write_lock); 258 spin_lock(&log->l_grant_write_lock);
@@ -3276,6 +3282,7 @@ xlog_ticket_alloc(
3276 } 3282 }
3277 3283
3278 atomic_set(&tic->t_ref, 1); 3284 atomic_set(&tic->t_ref, 1);
3285 tic->t_task = current;
3279 INIT_LIST_HEAD(&tic->t_queue); 3286 INIT_LIST_HEAD(&tic->t_queue);
3280 tic->t_unit_res = unit_bytes; 3287 tic->t_unit_res = unit_bytes;
3281 tic->t_curr_res = unit_bytes; 3288 tic->t_curr_res = unit_bytes;
@@ -3287,7 +3294,6 @@ xlog_ticket_alloc(
3287 tic->t_trans_type = 0; 3294 tic->t_trans_type = 0;
3288 if (xflags & XFS_LOG_PERM_RESERV) 3295 if (xflags & XFS_LOG_PERM_RESERV)
3289 tic->t_flags |= XLOG_TIC_PERM_RESERV; 3296 tic->t_flags |= XLOG_TIC_PERM_RESERV;
3290 init_waitqueue_head(&tic->t_wait);
3291 3297
3292 xlog_tic_reset_res(tic); 3298 xlog_tic_reset_res(tic);
3293 3299
@@ -3615,12 +3621,12 @@ xfs_log_force_umount(
3615 */ 3621 */
3616 spin_lock(&log->l_grant_reserve_lock); 3622 spin_lock(&log->l_grant_reserve_lock);
3617 list_for_each_entry(tic, &log->l_reserveq, t_queue) 3623 list_for_each_entry(tic, &log->l_reserveq, t_queue)
3618 wake_up(&tic->t_wait); 3624 wake_up_process(tic->t_task);
3619 spin_unlock(&log->l_grant_reserve_lock); 3625 spin_unlock(&log->l_grant_reserve_lock);
3620 3626
3621 spin_lock(&log->l_grant_write_lock); 3627 spin_lock(&log->l_grant_write_lock);
3622 list_for_each_entry(tic, &log->l_writeq, t_queue) 3628 list_for_each_entry(tic, &log->l_writeq, t_queue)
3623 wake_up(&tic->t_wait); 3629 wake_up_process(tic->t_task);
3624 spin_unlock(&log->l_grant_write_lock); 3630 spin_unlock(&log->l_grant_write_lock);
3625 3631
3626 if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) { 3632 if (!(log->l_iclog->ic_state & XLOG_STATE_IOERROR)) {
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 785905e3cf03..d8c5e47bbc2f 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -239,8 +239,8 @@ typedef struct xlog_res {
239} xlog_res_t; 239} xlog_res_t;
240 240
241typedef struct xlog_ticket { 241typedef struct xlog_ticket {
242 wait_queue_head_t t_wait; /* ticket wait queue */
243 struct list_head t_queue; /* reserve/write queue */ 242 struct list_head t_queue; /* reserve/write queue */
243 struct task_struct *t_task; /* task that owns this ticket */
244 xlog_tid_t t_tid; /* transaction identifier : 4 */ 244 xlog_tid_t t_tid; /* transaction identifier : 4 */
245 atomic_t t_ref; /* ticket reference count : 4 */ 245 atomic_t t_ref; /* ticket reference count : 4 */
246 int t_curr_res; /* current reservation in bytes : 4 */ 246 int t_curr_res; /* current reservation in bytes : 4 */