Skip to content

Commit

Permalink
[JFFS2] Improve garbage collector block selection
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
dedekind authored and Thomas Gleixner committed May 23, 2005
1 parent a921e28 commit a42163d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/jffs2/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 $
*
*/

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit a42163d

Please sign in to comment.