[PATCH] JFFS2: Erase max 3 EB's in jffs2_write_super()

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Tue Feb 2 04:40:00 EST 2010


Deleting big files in a JFFS2 root FS and the rebooting makes
the system hang until all freed EB's has been erased which
can take several minutes.
Fix the hanging by making jffs2_write_super() erase max 3 EB's
at a time. If there are more EB's to erase afterwards, reset the
s_dirty flag.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at transmode.se>
---

 I hope the list_empty calls doesn't need locking. If
 so, it can easily be added.

 fs/jffs2/super.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 9a80e8e..10393e0 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -64,7 +64,10 @@ static void jffs2_write_super(struct super_block *sb)
 	if (!(sb->s_flags & MS_RDONLY)) {
 		D1(printk(KERN_DEBUG "jffs2_write_super()\n"));
 		jffs2_garbage_collect_trigger(c);
-		jffs2_erase_pending_blocks(c, 0);
+		jffs2_erase_pending_blocks(c, 3);
+		if (!list_empty(&c->erase_complete_list) ||
+		    !list_empty(&c->erase_pending_list))
+			sb->s_dirt = 1;
 		jffs2_flush_wbuf_gc(c, 0);
 	}
 
-- 
1.6.4.4




More information about the linux-mtd mailing list