aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/jfs_logmgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs/jfs_logmgr.c')
-rw-r--r--fs/jfs/jfs_logmgr.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index d27bac6acaa3..0b348b13b551 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,15 +82,14 @@
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/*
88 * log read/write serialization (per log) 88 * log read/write serialization (per log)
89 */ 89 */
90#define LOG_LOCK_INIT(log) init_MUTEX(&(log)->loglock) 90#define LOG_LOCK_INIT(log) mutex_init(&(log)->loglock)
91#define LOG_LOCK(log) down(&((log)->loglock)) 91#define LOG_LOCK(log) mutex_lock(&((log)->loglock))
92#define LOG_UNLOCK(log) up(&((log)->loglock)) 92#define LOG_UNLOCK(log) mutex_unlock(&((log)->loglock))
93 93
94 94
95/* 95/*
@@ -1105,11 +1105,10 @@ int lmLogOpen(struct super_block *sb)
1105 } 1105 }
1106 } 1106 }
1107 1107
1108 if (!(log = kmalloc(sizeof(struct jfs_log), GFP_KERNEL))) { 1108 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL))) {
1109 up(&jfs_log_sem); 1109 up(&jfs_log_sem);
1110 return -ENOMEM; 1110 return -ENOMEM;
1111 } 1111 }
1112 memset(log, 0, sizeof(struct jfs_log));
1113 INIT_LIST_HEAD(&log->sb_list); 1112 INIT_LIST_HEAD(&log->sb_list);
1114 init_waitqueue_head(&log->syncwait); 1113 init_waitqueue_head(&log->syncwait);
1115 1114
@@ -1181,9 +1180,8 @@ static int open_inline_log(struct super_block *sb)
1181 struct jfs_log *log; 1180 struct jfs_log *log;
1182 int rc; 1181 int rc;
1183 1182
1184 if (!(log = kmalloc(sizeof(struct jfs_log), GFP_KERNEL))) 1183 if (!(log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL)))
1185 return -ENOMEM; 1184 return -ENOMEM;
1186 memset(log, 0, sizeof(struct jfs_log));
1187 INIT_LIST_HEAD(&log->sb_list); 1185 INIT_LIST_HEAD(&log->sb_list);
1188 init_waitqueue_head(&log->syncwait); 1186 init_waitqueue_head(&log->syncwait);
1189 1187
@@ -1216,12 +1214,11 @@ static int open_dummy_log(struct super_block *sb)
1216 1214
1217 down(&jfs_log_sem); 1215 down(&jfs_log_sem);
1218 if (!dummy_log) { 1216 if (!dummy_log) {
1219 dummy_log = kmalloc(sizeof(struct jfs_log), GFP_KERNEL); 1217 dummy_log = kzalloc(sizeof(struct jfs_log), GFP_KERNEL);
1220 if (!dummy_log) { 1218 if (!dummy_log) {
1221 up(&jfs_log_sem); 1219 up(&jfs_log_sem);
1222 return -ENOMEM; 1220 return -ENOMEM;
1223 } 1221 }
1224 memset(dummy_log, 0, sizeof(struct jfs_log));
1225 INIT_LIST_HEAD(&dummy_log->sb_list); 1222 INIT_LIST_HEAD(&dummy_log->sb_list);
1226 init_waitqueue_head(&dummy_log->syncwait); 1223 init_waitqueue_head(&dummy_log->syncwait);
1227 dummy_log->no_integrity = 1; 1224 dummy_log->no_integrity = 1;
@@ -1980,7 +1977,7 @@ static inline void lbmRedrive(struct lbuf *bp)
1980 log_redrive_list = bp; 1977 log_redrive_list = bp;
1981 spin_unlock_irqrestore(&log_redrive_lock, flags); 1978 spin_unlock_irqrestore(&log_redrive_lock, flags);
1982 1979
1983 wake_up(&jfs_IO_thread_wait); 1980 wake_up_process(jfsIOthread);
1984} 1981}
1985 1982
1986 1983
@@ -2347,13 +2344,7 @@ int jfsIOWait(void *arg)
2347{ 2344{
2348 struct lbuf *bp; 2345 struct lbuf *bp;
2349 2346
2350 daemonize("jfsIO");
2351
2352 complete(&jfsIOwait);
2353
2354 do { 2347 do {
2355 DECLARE_WAITQUEUE(wq, current);
2356
2357 spin_lock_irq(&log_redrive_lock); 2348 spin_lock_irq(&log_redrive_lock);
2358 while ((bp = log_redrive_list) != 0) { 2349 while ((bp = log_redrive_list) != 0) {
2359 log_redrive_list = bp->l_redrive_next; 2350 log_redrive_list = bp->l_redrive_next;
@@ -2362,21 +2353,19 @@ int jfsIOWait(void *arg)
2362 lbmStartIO(bp); 2353 lbmStartIO(bp);
2363 spin_lock_irq(&log_redrive_lock); 2354 spin_lock_irq(&log_redrive_lock);
2364 } 2355 }
2356 spin_unlock_irq(&log_redrive_lock);
2357
2365 if (freezing(current)) { 2358 if (freezing(current)) {
2366 spin_unlock_irq(&log_redrive_lock);
2367 refrigerator(); 2359 refrigerator();
2368 } else { 2360 } else {
2369 add_wait_queue(&jfs_IO_thread_wait, &wq);
2370 set_current_state(TASK_INTERRUPTIBLE); 2361 set_current_state(TASK_INTERRUPTIBLE);
2371 spin_unlock_irq(&log_redrive_lock);
2372 schedule(); 2362 schedule();
2373 current->state = TASK_RUNNING; 2363 current->state = TASK_RUNNING;
2374 remove_wait_queue(&jfs_IO_thread_wait, &wq);
2375 } 2364 }
2376 } while (!jfs_stop_threads); 2365 } while (!kthread_should_stop());
2377 2366
2378 jfs_info("jfsIOWait being killed!"); 2367 jfs_info("jfsIOWait being killed!");
2379 complete_and_exit(&jfsIOwait, 0); 2368 return 0;
2380} 2369}
2381 2370
2382/* 2371/*