|
1443
|
1 /* |
|
|
2 * JFFS2 -- Journalling Flash File System, Version 2. |
|
|
3 * |
|
|
4 * Copyright (C) 2001-2003 Red Hat, Inc. |
|
|
5 * |
|
|
6 * Created by David Woodhouse <dwmw2@redhat.com> |
|
|
7 * |
|
|
8 * For licensing information, see the file 'LICENCE' in this directory. |
|
|
9 * |
|
|
10 * $Id: gcthread.c,v 1.1 2003/11/26 15:55:35 dwmw2 Exp $ |
|
|
11 * |
|
|
12 */ |
|
|
13 |
|
|
14 #include <linux/kernel.h> |
|
|
15 #include <linux/types.h> |
|
|
16 #include <linux/jffs2.h> |
|
|
17 #include "nodelist.h" |
|
|
18 |
|
|
19 |
|
|
20 static void jffs2_garbage_collect_thread(struct jffs2_sb_info *c); |
|
|
21 |
|
|
22 void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) |
|
|
23 { |
|
|
24 /* Wake up the thread */ |
|
|
25 (void)&jffs2_garbage_collect_thread; |
|
|
26 } |
|
|
27 |
|
|
28 void jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) |
|
|
29 { |
|
|
30 /* Start the thread. Doesn't matter if it fails -- it's only an optimisation anyway */ |
|
|
31 } |
|
|
32 |
|
|
33 void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) |
|
|
34 { |
|
|
35 /* Stop the thread and wait for it if necessary */ |
|
|
36 } |
|
|
37 |
|
|
38 |
|
|
39 static void jffs2_garbage_collect_thread(struct jffs2_sb_info *c) |
|
|
40 { |
|
|
41 #define this_thread_should_die() 0 |
|
|
42 while(!this_thread_should_die()) { |
|
|
43 while(!jffs2_thread_should_wake(c)) { |
|
|
44 /* Sleep.... */ |
|
|
45 continue; |
|
|
46 } |
|
|
47 if (jffs2_garbage_collect_pass(c) == -ENOSPC) { |
|
|
48 printf("No space for garbage collection. Aborting JFFS2 GC thread\n"); |
|
|
49 break; |
|
|
50 } |
|
|
51 } |
|
|
52 } |