aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_logmgr.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-02-15 13:49:04 -0500
committerDave Kleikamp <shaggy@austin.ibm.com>2006-02-15 13:49:04 -0500
commit91dbb4deb30e817efc8d6bed89b1190a489ca776 (patch)
treed3742a35be49da1ab785ac398459d7a71a64a765 /fs/jfs/jfs_logmgr.c
parent4837c672fd4d43c519d6b53308ee68d45b91b872 (diff)
JFS: Use the kthread_ API
Use the kthread_ API instead of opencoding lots of hairy code for kernel thread creation and teardown. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs/jfs/jfs_logmgr.c')
-rw-r--r--fs/jfs/jfs_logmgr.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 06bded6c12b9..3113ff53bd55 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -64,6 +64,7 @@
64#include <linux/interrupt.h> 64#include <linux/interrupt.h>
65#include <linux/smp_lock.h> 65#include <linux/smp_lock.h>
66#include <linux/completion.h> 66#include <linux/completion.h>
67#include <linux/kthread.h>
67#include <linux/buffer_head.h> /* for sync_blockdev() */ 68#include <linux/buffer_head.h> /* for sync_blockdev() */
68#include <linux/bio.h> 69#include <linux/bio.h>
69#include <linux/suspend.h> 70#include <linux/suspend.h>
@@ -81,7 +82,6 @@
81 */ 82 */
82static struct lbuf *log_redrive_list; 83static struct lbuf *log_redrive_list;
83static DEFINE_SPINLOCK(log_redrive_lock); 84static DEFINE_SPINLOCK(log_redrive_lock);
84DECLARE_WAIT_QUEUE_HEAD(jfs_IO_thread_wait);
85 85
86 86
87/* 87/*
@@ -1980,7 +1980,7 @@ static inline void lbmRedrive(struct lbuf *bp)
1980 log_redrive_list = bp; 1980 log_redrive_list = bp;
1981 spin_unlock_irqrestore(&log_redrive_lock, flags); 1981 spin_unlock_irqrestore(&log_redrive_lock, flags);
1982 1982
1983 wake_up(&jfs_IO_thread_wait); 1983 wake_up_process(jfsIOthread);
1984} 1984}
1985 1985
1986 1986
@@ -2347,13 +2347,7 @@ int jfsIOWait(void *arg)
2347{ 2347{
2348 struct lbuf *bp; 2348 struct lbuf *bp;
2349 2349
2350 daemonize("jfsIO");
2351
2352 complete(&jfsIOwait);
2353
2354 do { 2350 do {
2355 DECLARE_WAITQUEUE(wq, current);
2356
2357 spin_lock_irq(&log_redrive_lock); 2351 spin_lock_irq(&log_redrive_lock);
2358 while ((bp = log_redrive_list) != 0) { 2352 while ((bp = log_redrive_list) != 0) {
2359 log_redrive_list = bp->l_redrive_next; 2353 log_redrive_list = bp->l_redrive_next;
@@ -2362,21 +2356,19 @@ int jfsIOWait(void *arg)
2362 lbmStartIO(bp); 2356 lbmStartIO(bp);
2363 spin_lock_irq(&log_redrive_lock); 2357 spin_lock_irq(&log_redrive_lock);
2364 } 2358 }
2359 spin_unlock_irq(&log_redrive_lock);
2360
2365 if (freezing(current)) { 2361 if (freezing(current)) {
2366 spin_unlock_irq(&log_redrive_lock);
2367 refrigerator(); 2362 refrigerator();
2368 } else { 2363 } else {
2369 add_wait_queue(&jfs_IO_thread_wait, &wq);
2370 set_current_state(TASK_INTERRUPTIBLE); 2364 set_current_state(TASK_INTERRUPTIBLE);
2371 spin_unlock_irq(&log_redrive_lock);
2372 schedule(); 2365 schedule();
2373 current->state = TASK_RUNNING; 2366 current->state = TASK_RUNNING;
2374 remove_wait_queue(&jfs_IO_thread_wait, &wq);
2375 } 2367 }
2376 } while (!jfs_stop_threads); 2368 } while (!kthread_should_stop());
2377 2369
2378 jfs_info("jfsIOWait being killed!"); 2370 jfs_info("jfsIOWait being killed!");
2379 complete_and_exit(&jfsIOwait, 0); 2371 return 0;
2380} 2372}
2381 2373
2382/* 2374/*