Lines Matching refs:c
51 static int thread_should_wake(struct jffs2_sb_info *c);
53 void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) in jffs2_garbage_collect_trigger() argument
55 spin_lock_bh(&c->erase_completion_lock); in jffs2_garbage_collect_trigger()
56 if (c->gc_task && thread_should_wake(c)) in jffs2_garbage_collect_trigger()
57 send_sig(SIGHUP, c->gc_task, 1); in jffs2_garbage_collect_trigger()
58 spin_unlock_bh(&c->erase_completion_lock); in jffs2_garbage_collect_trigger()
62 int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) in jffs2_start_garbage_collect_thread() argument
67 if (c->gc_task) in jffs2_start_garbage_collect_thread()
70 init_MUTEX_LOCKED(&c->gc_thread_start); in jffs2_start_garbage_collect_thread()
71 init_completion(&c->gc_thread_exit); in jffs2_start_garbage_collect_thread()
73 pid = kernel_thread(jffs2_garbage_collect_thread, c, CLONE_FS|CLONE_FILES); in jffs2_start_garbage_collect_thread()
76 complete(&c->gc_thread_exit); in jffs2_start_garbage_collect_thread()
81 down(&c->gc_thread_start); in jffs2_start_garbage_collect_thread()
87 void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) in jffs2_stop_garbage_collect_thread() argument
89 spin_lock_bh(&c->erase_completion_lock); in jffs2_stop_garbage_collect_thread()
90 if (c->gc_task) { in jffs2_stop_garbage_collect_thread()
91 D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid)); in jffs2_stop_garbage_collect_thread()
92 send_sig(SIGKILL, c->gc_task, 1); in jffs2_stop_garbage_collect_thread()
94 spin_unlock_bh(&c->erase_completion_lock); in jffs2_stop_garbage_collect_thread()
95 wait_for_completion(&c->gc_thread_exit); in jffs2_stop_garbage_collect_thread()
100 struct jffs2_sb_info *c = _c; in jffs2_garbage_collect_thread() local
104 c->gc_task = current; in jffs2_garbage_collect_thread()
105 up(&c->gc_thread_start); in jffs2_garbage_collect_thread()
107 sprintf(current->comm, "jffs2_gcd_mtd%d", c->mtd->index); in jffs2_garbage_collect_thread()
118 if (!thread_should_wake(c)) { in jffs2_garbage_collect_thread()
150 spin_lock_bh(&c->erase_completion_lock); in jffs2_garbage_collect_thread()
151 c->gc_task = NULL; in jffs2_garbage_collect_thread()
152 spin_unlock_bh(&c->erase_completion_lock); in jffs2_garbage_collect_thread()
153 complete_and_exit(&c->gc_thread_exit, 0); in jffs2_garbage_collect_thread()
170 jffs2_garbage_collect_pass(c); in jffs2_garbage_collect_thread()
174 static int thread_should_wake(struct jffs2_sb_info *c) in thread_should_wake() argument
177 c->nr_free_blocks, c->nr_erasing_blocks, c->dirty_size)); in thread_should_wake()
178 if (c->nr_free_blocks + c->nr_erasing_blocks < JFFS2_RESERVED_BLOCKS_GCTRIGGER && in thread_should_wake()
179 c->dirty_size > c->sector_size) in thread_should_wake()