From acb64a43e4503fbea9faf123f2403da7af8831eb Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 19 May 2010 17:00:10 +0100 Subject: jffs2: Require jffs2_garbage_collect_trigger() to be called with lock held We're about to call this from a bunch of places which already hold c->erase_completion_lock, so add an assertion and change its existing callers to do the same. Signed-off-by: David Woodhouse --- fs/jffs2/super.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/jffs2/super.c') diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 9a80e8e595d0..12cc967c5c03 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -63,7 +63,9 @@ static void jffs2_write_super(struct super_block *sb) if (!(sb->s_flags & MS_RDONLY)) { D1(printk(KERN_DEBUG "jffs2_write_super()\n")); + spin_lock(&c->erase_completion_lock); jffs2_garbage_collect_trigger(c); + spin_unlock(&c->erase_completion_lock); jffs2_erase_pending_blocks(c, 0); jffs2_flush_wbuf_gc(c, 0); } -- cgit v1.2.3 From 9723152ad1efb844445e63f052e6d39e85e11649 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Wed, 19 May 2010 17:16:11 +0100 Subject: jffs2: Stop triggering block erases from jffs2_write_super() This is the culmination of this sequence of patches. By moving the block erasing from jffs2_write_super() into the GC code, we avoid huge latencies on unmount where it waits for _all_ pending blocks to be erased, and we allow better control for time-critical tasks by stopping the GC thread. Signed-off-by: Joakim Tjernlund Signed-off-by: David Woodhouse --- fs/jffs2/super.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'fs/jffs2/super.c') diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 12cc967c5c03..511e2d609d12 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -63,10 +63,6 @@ static void jffs2_write_super(struct super_block *sb) if (!(sb->s_flags & MS_RDONLY)) { D1(printk(KERN_DEBUG "jffs2_write_super()\n")); - spin_lock(&c->erase_completion_lock); - jffs2_garbage_collect_trigger(c); - spin_unlock(&c->erase_completion_lock); - jffs2_erase_pending_blocks(c, 0); jffs2_flush_wbuf_gc(c, 0); } -- cgit v1.2.3