aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_txnmgr.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_txnmgr.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_txnmgr.c')
-rw-r--r--fs/jfs/jfs_txnmgr.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index d38f605d9481..ac3d66948e8c 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -49,6 +49,7 @@
49#include <linux/suspend.h> 49#include <linux/suspend.h>
50#include <linux/module.h> 50#include <linux/module.h>
51#include <linux/moduleparam.h> 51#include <linux/moduleparam.h>
52#include <linux/kthread.h>
52#include "jfs_incore.h" 53#include "jfs_incore.h"
53#include "jfs_inode.h" 54#include "jfs_inode.h"
54#include "jfs_filsys.h" 55#include "jfs_filsys.h"
@@ -121,8 +122,7 @@ static DEFINE_SPINLOCK(jfsTxnLock);
121#define LAZY_LOCK(flags) spin_lock_irqsave(&TxAnchor.LazyLock, flags) 122#define LAZY_LOCK(flags) spin_lock_irqsave(&TxAnchor.LazyLock, flags)
122#define LAZY_UNLOCK(flags) spin_unlock_irqrestore(&TxAnchor.LazyLock, flags) 123#define LAZY_UNLOCK(flags) spin_unlock_irqrestore(&TxAnchor.LazyLock, flags)
123 124
124DECLARE_WAIT_QUEUE_HEAD(jfs_sync_thread_wait); 125static DECLARE_WAIT_QUEUE_HEAD(jfs_commit_thread_wait);
125DECLARE_WAIT_QUEUE_HEAD(jfs_commit_thread_wait);
126static int jfs_commit_thread_waking; 126static int jfs_commit_thread_waking;
127 127
128/* 128/*
@@ -207,7 +207,7 @@ static lid_t txLockAlloc(void)
207 if ((++TxAnchor.tlocksInUse > TxLockHWM) && (jfs_tlocks_low == 0)) { 207 if ((++TxAnchor.tlocksInUse > TxLockHWM) && (jfs_tlocks_low == 0)) {
208 jfs_info("txLockAlloc tlocks low"); 208 jfs_info("txLockAlloc tlocks low");
209 jfs_tlocks_low = 1; 209 jfs_tlocks_low = 1;
210 wake_up(&jfs_sync_thread_wait); 210 wake_up_process(jfsSyncThread);
211 } 211 }
212 212
213 return lid; 213 return lid;
@@ -2743,10 +2743,6 @@ int jfs_lazycommit(void *arg)
2743 unsigned long flags; 2743 unsigned long flags;
2744 struct jfs_sb_info *sbi; 2744 struct jfs_sb_info *sbi;
2745 2745
2746 daemonize("jfsCommit");
2747
2748 complete(&jfsIOwait);
2749
2750 do { 2746 do {
2751 LAZY_LOCK(flags); 2747 LAZY_LOCK(flags);
2752 jfs_commit_thread_waking = 0; /* OK to wake another thread */ 2748 jfs_commit_thread_waking = 0; /* OK to wake another thread */
@@ -2806,13 +2802,13 @@ int jfs_lazycommit(void *arg)
2806 current->state = TASK_RUNNING; 2802 current->state = TASK_RUNNING;
2807 remove_wait_queue(&jfs_commit_thread_wait, &wq); 2803 remove_wait_queue(&jfs_commit_thread_wait, &wq);
2808 } 2804 }
2809 } while (!jfs_stop_threads); 2805 } while (!kthread_should_stop());
2810 2806
2811 if (!list_empty(&TxAnchor.unlock_queue)) 2807 if (!list_empty(&TxAnchor.unlock_queue))
2812 jfs_err("jfs_lazycommit being killed w/pending transactions!"); 2808 jfs_err("jfs_lazycommit being killed w/pending transactions!");
2813 else 2809 else
2814 jfs_info("jfs_lazycommit being killed\n"); 2810 jfs_info("jfs_lazycommit being killed\n");
2815 complete_and_exit(&jfsIOwait, 0); 2811 return 0;
2816} 2812}
2817 2813
2818void txLazyUnlock(struct tblock * tblk) 2814void txLazyUnlock(struct tblock * tblk)
@@ -2932,10 +2928,6 @@ int jfs_sync(void *arg)
2932 int rc; 2928 int rc;
2933 tid_t tid; 2929 tid_t tid;
2934 2930
2935 daemonize("jfsSync");
2936
2937 complete(&jfsIOwait);
2938
2939 do { 2931 do {
2940 /* 2932 /*
2941 * write each inode on the anonymous inode list 2933 * write each inode on the anonymous inode list
@@ -2996,19 +2988,15 @@ int jfs_sync(void *arg)
2996 TXN_UNLOCK(); 2988 TXN_UNLOCK();
2997 refrigerator(); 2989 refrigerator();
2998 } else { 2990 } else {
2999 DECLARE_WAITQUEUE(wq, current);
3000
3001 add_wait_queue(&jfs_sync_thread_wait, &wq);
3002 set_current_state(TASK_INTERRUPTIBLE); 2991 set_current_state(TASK_INTERRUPTIBLE);
3003 TXN_UNLOCK(); 2992 TXN_UNLOCK();
3004 schedule(); 2993 schedule();
3005 current->state = TASK_RUNNING; 2994 current->state = TASK_RUNNING;
3006 remove_wait_queue(&jfs_sync_thread_wait, &wq);
3007 } 2995 }
3008 } while (!jfs_stop_threads); 2996 } while (!kthread_should_stop());
3009 2997
3010 jfs_info("jfs_sync being killed"); 2998 jfs_info("jfs_sync being killed");
3011 complete_and_exit(&jfsIOwait, 0); 2999 return 0;
3012} 3000}
3013 3001
3014#if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_DEBUG) 3002#if defined(CONFIG_PROC_FS) && defined(CONFIG_JFS_DEBUG)