diff options
Diffstat (limited to 'fs/jffs2/background.c')
-rw-r--r-- | fs/jffs2/background.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 404111b016c9..2b60ce1996aa 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
14 | |||
13 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
14 | #include <linux/jffs2.h> | 16 | #include <linux/jffs2.h> |
15 | #include <linux/mtd/mtd.h> | 17 | #include <linux/mtd/mtd.h> |
@@ -42,12 +44,13 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) | |||
42 | 44 | ||
43 | tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index); | 45 | tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index); |
44 | if (IS_ERR(tsk)) { | 46 | if (IS_ERR(tsk)) { |
45 | printk(KERN_WARNING "fork failed for JFFS2 garbage collect thread: %ld\n", -PTR_ERR(tsk)); | 47 | pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n", |
48 | -PTR_ERR(tsk)); | ||
46 | complete(&c->gc_thread_exit); | 49 | complete(&c->gc_thread_exit); |
47 | ret = PTR_ERR(tsk); | 50 | ret = PTR_ERR(tsk); |
48 | } else { | 51 | } else { |
49 | /* Wait for it... */ | 52 | /* Wait for it... */ |
50 | D1(printk(KERN_DEBUG "JFFS2: Garbage collect thread is pid %d\n", tsk->pid)); | 53 | jffs2_dbg(1, "Garbage collect thread is pid %d\n", tsk->pid); |
51 | wait_for_completion(&c->gc_thread_start); | 54 | wait_for_completion(&c->gc_thread_start); |
52 | ret = tsk->pid; | 55 | ret = tsk->pid; |
53 | } | 56 | } |
@@ -60,7 +63,7 @@ void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) | |||
60 | int wait = 0; | 63 | int wait = 0; |
61 | spin_lock(&c->erase_completion_lock); | 64 | spin_lock(&c->erase_completion_lock); |
62 | if (c->gc_task) { | 65 | if (c->gc_task) { |
63 | D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid)); | 66 | jffs2_dbg(1, "Killing GC task %d\n", c->gc_task->pid); |
64 | send_sig(SIGKILL, c->gc_task, 1); | 67 | send_sig(SIGKILL, c->gc_task, 1); |
65 | wait = 1; | 68 | wait = 1; |
66 | } | 69 | } |
@@ -90,7 +93,7 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
90 | if (!jffs2_thread_should_wake(c)) { | 93 | if (!jffs2_thread_should_wake(c)) { |
91 | set_current_state (TASK_INTERRUPTIBLE); | 94 | set_current_state (TASK_INTERRUPTIBLE); |
92 | spin_unlock(&c->erase_completion_lock); | 95 | spin_unlock(&c->erase_completion_lock); |
93 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n")); | 96 | jffs2_dbg(1, "%s(): sleeping...\n", __func__); |
94 | schedule(); | 97 | schedule(); |
95 | } else | 98 | } else |
96 | spin_unlock(&c->erase_completion_lock); | 99 | spin_unlock(&c->erase_completion_lock); |
@@ -109,7 +112,7 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
109 | schedule_timeout_interruptible(msecs_to_jiffies(50)); | 112 | schedule_timeout_interruptible(msecs_to_jiffies(50)); |
110 | 113 | ||
111 | if (kthread_should_stop()) { | 114 | if (kthread_should_stop()) { |
112 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): kthread_stop() called.\n")); | 115 | jffs2_dbg(1, "%s(): kthread_stop() called\n", __func__); |
113 | goto die; | 116 | goto die; |
114 | } | 117 | } |
115 | 118 | ||
@@ -126,28 +129,32 @@ static int jffs2_garbage_collect_thread(void *_c) | |||
126 | 129 | ||
127 | switch(signr) { | 130 | switch(signr) { |
128 | case SIGSTOP: | 131 | case SIGSTOP: |
129 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGSTOP received.\n")); | 132 | jffs2_dbg(1, "%s(): SIGSTOP received\n", |
133 | __func__); | ||
130 | set_current_state(TASK_STOPPED); | 134 | set_current_state(TASK_STOPPED); |
131 | schedule(); | 135 | schedule(); |
132 | break; | 136 | break; |
133 | 137 | ||
134 | case SIGKILL: | 138 | case SIGKILL: |
135 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGKILL received.\n")); | 139 | jffs2_dbg(1, "%s(): SIGKILL received\n", |
140 | __func__); | ||
136 | goto die; | 141 | goto die; |
137 | 142 | ||
138 | case SIGHUP: | 143 | case SIGHUP: |
139 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGHUP received.\n")); | 144 | jffs2_dbg(1, "%s(): SIGHUP received\n", |
145 | __func__); | ||
140 | break; | 146 | break; |
141 | default: | 147 | default: |
142 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): signal %ld received\n", signr)); | 148 | jffs2_dbg(1, "%s(): signal %ld received\n", |
149 | __func__, signr); | ||
143 | } | 150 | } |
144 | } | 151 | } |
145 | /* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */ | 152 | /* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */ |
146 | disallow_signal(SIGHUP); | 153 | disallow_signal(SIGHUP); |
147 | 154 | ||
148 | D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): pass\n")); | 155 | jffs2_dbg(1, "%s(): pass\n", __func__); |
149 | if (jffs2_garbage_collect_pass(c) == -ENOSPC) { | 156 | if (jffs2_garbage_collect_pass(c) == -ENOSPC) { |
150 | printk(KERN_NOTICE "No space for garbage collection. Aborting GC thread\n"); | 157 | pr_notice("No space for garbage collection. Aborting GC thread\n"); |
151 | goto die; | 158 | goto die; |
152 | } | 159 | } |
153 | } | 160 | } |