Commit 9957abea31aed5783d6ca7175cce553045c0eb19
Committed by
David Woodhouse
1 parent
cd874237d9
Exists in
master
and in
4 other branches
jffs2: Add 'work_done' return value from jffs2_erase_pending_blocks()
We're about to start calling this from the jffs2_garbage_collect_pass(), and we'll want to know whether it actually did anything or not. Signed-off-by: Joakim Tjernlund <joakim.tjernlund@transmode.se> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Showing 2 changed files with 5 additions and 2 deletions Side-by-side Diff
fs/jffs2/erase.c
... | ... | @@ -103,9 +103,10 @@ |
103 | 103 | jffs2_erase_failed(c, jeb, bad_offset); |
104 | 104 | } |
105 | 105 | |
106 | -void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count) | |
106 | +int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count) | |
107 | 107 | { |
108 | 108 | struct jffs2_eraseblock *jeb; |
109 | + int work_done = 0; | |
109 | 110 | |
110 | 111 | mutex_lock(&c->erase_free_sem); |
111 | 112 | |
... | ... | @@ -121,6 +122,7 @@ |
121 | 122 | mutex_unlock(&c->erase_free_sem); |
122 | 123 | jffs2_mark_erased_block(c, jeb); |
123 | 124 | |
125 | + work_done++; | |
124 | 126 | if (!--count) { |
125 | 127 | D1(printk(KERN_DEBUG "Count reached. jffs2_erase_pending_blocks leaving\n")); |
126 | 128 | goto done; |
... | ... | @@ -157,6 +159,7 @@ |
157 | 159 | mutex_unlock(&c->erase_free_sem); |
158 | 160 | done: |
159 | 161 | D1(printk(KERN_DEBUG "jffs2_erase_pending_blocks completed\n")); |
162 | + return work_done; | |
160 | 163 | } |
161 | 164 | |
162 | 165 | static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) |
fs/jffs2/nodelist.h
... | ... | @@ -464,7 +464,7 @@ |
464 | 464 | int jffs2_do_mount_fs(struct jffs2_sb_info *c); |
465 | 465 | |
466 | 466 | /* erase.c */ |
467 | -void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count); | |
467 | +int jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count); | |
468 | 468 | void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); |
469 | 469 | |
470 | 470 | #ifdef CONFIG_JFFS2_FS_WRITEBUFFER |