Commit e63a85b6 authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] Stop using sleep_on

SGI Modid: xfs-linux:xfs-kern:165673a
parent 876a4fb3
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
*/ */
STATIC kmem_cache_t *pagebuf_cache; STATIC kmem_cache_t *pagebuf_cache;
STATIC void pagebuf_daemon_wakeup(int); STATIC void pagebuf_daemon_wakeup(void);
STATIC void pagebuf_delwri_queue(page_buf_t *, int); STATIC void pagebuf_delwri_queue(page_buf_t *, int);
STATIC struct workqueue_struct *pagebuf_logio_workqueue; STATIC struct workqueue_struct *pagebuf_logio_workqueue;
STATIC struct workqueue_struct *pagebuf_dataio_workqueue; STATIC struct workqueue_struct *pagebuf_dataio_workqueue;
...@@ -516,7 +516,7 @@ _pagebuf_lookup_pages( ...@@ -516,7 +516,7 @@ _pagebuf_lookup_pages(
if (!page) { if (!page) {
if (--retry_count > 0) { if (--retry_count > 0) {
PB_STATS_INC(pb_page_retries); PB_STATS_INC(pb_page_retries);
pagebuf_daemon_wakeup(1); pagebuf_daemon_wakeup();
current->state = TASK_UNINTERRUPTIBLE; current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(10); schedule_timeout(10);
goto retry; goto retry;
...@@ -1646,7 +1646,6 @@ pagebuf_iomove( ...@@ -1646,7 +1646,6 @@ pagebuf_iomove(
* Pagebuf delayed write buffer handling * Pagebuf delayed write buffer handling
*/ */
STATIC int pbd_active = 1;
STATIC LIST_HEAD(pbd_delwrite_queue); STATIC LIST_HEAD(pbd_delwrite_queue);
STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED; STATIC spinlock_t pbd_delwrite_lock = SPIN_LOCK_UNLOCKED;
...@@ -1693,21 +1692,19 @@ pagebuf_runall_queues( ...@@ -1693,21 +1692,19 @@ pagebuf_runall_queues(
} }
/* Defines for pagebuf daemon */ /* Defines for pagebuf daemon */
DECLARE_WAIT_QUEUE_HEAD(pbd_waitq); STATIC DECLARE_COMPLETION(pagebuf_daemon_done);
STATIC struct task_struct *pagebuf_daemon_task;
STATIC int pagebuf_daemon_active;
STATIC int force_flush; STATIC int force_flush;
STATIC void STATIC void
pagebuf_daemon_wakeup( pagebuf_daemon_wakeup(void)
int flag)
{ {
force_flush = flag; force_flush = 1;
if (waitqueue_active(&pbd_waitq)) { barrier();
wake_up_interruptible(&pbd_waitq); wake_up_process(pagebuf_daemon_task);
}
} }
typedef void (*timeout_fn)(unsigned long);
STATIC int STATIC int
pagebuf_daemon( pagebuf_daemon(
void *data) void *data)
...@@ -1715,29 +1712,23 @@ pagebuf_daemon( ...@@ -1715,29 +1712,23 @@ pagebuf_daemon(
int count; int count;
page_buf_t *pb; page_buf_t *pb;
struct list_head *curr, *next, tmp; struct list_head *curr, *next, tmp;
struct timer_list pb_daemon_timer =
TIMER_INITIALIZER((timeout_fn)pagebuf_daemon_wakeup, 0, 0);
/* Set up the thread */ /* Set up the thread */
daemonize("pagebufd"); daemonize("pagebufd");
current->flags |= PF_MEMALLOC; current->flags |= PF_MEMALLOC;
pagebuf_daemon_task = current;
pagebuf_daemon_active = 1;
barrier();
INIT_LIST_HEAD(&tmp); INIT_LIST_HEAD(&tmp);
do { do {
/* swsusp */ /* swsusp */
if (current->flags & PF_FREEZE) if (current->flags & PF_FREEZE)
refrigerator(PF_IOTHREAD); refrigerator(PF_IOTHREAD);
if (pbd_active == 1) { set_current_state(TASK_INTERRUPTIBLE);
mod_timer(&pb_daemon_timer, schedule_timeout(pb_params.flush_interval.val);
jiffies + pb_params.flush_interval.val);
interruptible_sleep_on(&pbd_waitq);
}
if (pbd_active == 0) {
del_timer_sync(&pb_daemon_timer);
}
spin_lock(&pbd_delwrite_lock); spin_lock(&pbd_delwrite_lock);
...@@ -1781,12 +1772,9 @@ pagebuf_daemon( ...@@ -1781,12 +1772,9 @@ pagebuf_daemon(
blk_run_queues(); blk_run_queues();
force_flush = 0; force_flush = 0;
} while (pbd_active == 1); } while (pagebuf_daemon_active);
pbd_active = -1;
wake_up_interruptible(&pbd_waitq);
return 0; complete_and_exit(&pagebuf_daemon_done, 0);
} }
void void
...@@ -1896,9 +1884,10 @@ pagebuf_daemon_start(void) ...@@ -1896,9 +1884,10 @@ pagebuf_daemon_start(void)
STATIC void STATIC void
pagebuf_daemon_stop(void) pagebuf_daemon_stop(void)
{ {
pbd_active = 0; pagebuf_daemon_active = 0;
wake_up_interruptible(&pbd_waitq); barrier();
wait_event_interruptible(pbd_waitq, pbd_active); wait_for_completion(&pagebuf_daemon_done);
destroy_workqueue(pagebuf_logio_workqueue); destroy_workqueue(pagebuf_logio_workqueue);
destroy_workqueue(pagebuf_dataio_workqueue); destroy_workqueue(pagebuf_dataio_workqueue);
} }
......
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