[PATCH][JFFS2] Fix garbage collector block search

Jörn Engel joern at logfs.org
Mon Jan 14 08:28:43 EST 2008


On Wed, 12 December 2007 18:51:28 +0300, Alexander Belyakov wrote:
> 
> The patch checks if erasable_list is empty in jffs2_refile_wbuf_blocks() moving at least one block to that list. So jffs2_find_gc_block() will not fail sometimes with "jffs2: No clean, dirty _or_ erasable blocks to GC from! Where are they all?" message.

If the erasable_list is empty, we push it to the list for someone else
to erase it later instead of doing it now?  Nonsense.

If it makes a difference whether the block is erasable or erase_pending,
we have a bug.  And that bug wants a fix, not a paper bandaid.

> Signed-off-by: Alexander Belyakov <alexander.belyakov at intel.com>
> 
> diff -uNr a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
> --- a/fs/jffs2/wbuf.c	2007-12-03 17:00:16.000000000 +0300
> +++ b/fs/jffs2/wbuf.c	2007-12-11 19:03:03.000000000 +0300
> @@ -115,7 +115,7 @@
>  
>  		D1(printk(KERN_DEBUG "Removing eraseblock at 0x%08x from erasable_pending_wbuf_list...\n", jeb->offset));
>  		list_del(this);
> -		if ((jiffies + (n++)) & 127) {
> +		if (((jiffies + (n++)) & 127) && !list_empty(&c->erasable_list)) {
>  			/* Most of the time, we just erase it immediately. Otherwise we
>  			   spend ages scanning it on mount, etc. */
>  			D1(printk(KERN_DEBUG "...and adding to erase_pending_list\n"));
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 

Jörn

-- 
Joern's library part 14:
http://www.sandpile.org/



More information about the linux-mtd mailing list