summaryrefslogtreecommitdiff
path: root/fs/jffs2
diff options
context:
space:
mode:
authorArtem B. Bityuckiy <dedekind@infradead.org>2005-03-20 17:45:29 +0000
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 13:01:25 +0200
commita42163d7c331c2532551f675d6616a00e1e87fe9 (patch)
treef437025983cca8c43ee33e839199d0ee091c8107 /fs/jffs2
parenta921e28b4bd35b091754a1814ff015fe268b9295 (diff)
[JFFS2] Improve garbage collector block selection
Make sure the erase_pending_wbuf_list's blocks are taken into account when picking the block to GC. Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/gc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index 61ae001eced5..44fa7379098f 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: gc.c,v 1.145 2005/02/09 09:09:01 pavlov Exp $
+ * $Id: gc.c,v 1.146 2005/03/20 17:45:25 dedekind Exp $
*
*/
@@ -50,6 +50,7 @@ static struct jffs2_eraseblock *jffs2_find_gc_block(struct jffs2_sb_info *c)
put the clever wear-levelling algorithms. Eventually. */
/* We possibly want to favour the dirtier blocks more when the
number of free blocks is low. */
+again:
if (!list_empty(&c->bad_used_list) && c->nr_free_blocks > c->resv_blocks_gcbad) {
D1(printk(KERN_DEBUG "Picking block from bad_used_list to GC next\n"));
nextlist = &c->bad_used_list;
@@ -79,6 +80,11 @@ static struct jffs2_eraseblock *jffs2_find_gc_block(struct jffs2_sb_info *c)
D1(printk(KERN_DEBUG "Picking block from erasable_list to GC next (clean_list and {very_,}dirty_list were empty)\n"));
nextlist = &c->erasable_list;
+ } else if (!list_empty(&c->erasable_pending_wbuf_list)) {
+ /* There are blocks are wating for the wbuf sync */
+ D1(printk(KERN_DEBUG "Synching wbuf in order to reuse erasable_pending_wbuf_list blocks\n"));
+ jffs2_flush_wbuf_pad(c);
+ goto again;
} else {
/* Eep. All were empty */
D1(printk(KERN_NOTICE "jffs2: No clean, dirty _or_ erasable blocks to GC from! Where are they all?\n"));