From patchwork Tue Feb 2 09:40:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Tjernlund X-Patchwork-Id: 44260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6671DB7D3D for ; Tue, 2 Feb 2010 20:43:21 +1100 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NcFFl-00023e-QR; Tue, 02 Feb 2010 09:41:01 +0000 Received: from gw1.transmode.se ([213.115.205.20]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1NcFFe-0001rK-7J for linux-mtd@lists.infradead.org; Tue, 02 Feb 2010 09:40:59 +0000 Received: from sesr04.transmode.se (sesr04.transmode.se [192.168.201.15]) by gw1.transmode.se (Postfix) with ESMTP id A9F33650002 for ; Tue, 2 Feb 2010 10:40:02 +0100 (CET) Received: from gentoo-jocke.transmode.se ([192.168.1.15]) by sesr04.transmode.se (Lotus Domino Release 8.5.1) with ESMTP id 2010020210400281-5771 ; Tue, 2 Feb 2010 10:40:02 +0100 Received: from gentoo-jocke.transmode.se (gentoo-jocke.transmode.se [127.0.0.1]) by gentoo-jocke.transmode.se (8.14.4/8.14.0) with ESMTP id o129e2dK032578; Tue, 2 Feb 2010 10:40:02 +0100 Received: (from jocke@localhost) by gentoo-jocke.transmode.se (8.14.4/8.14.4/Submit) id o129e2t0032577; Tue, 2 Feb 2010 10:40:02 +0100 From: Joakim Tjernlund To: linux-mtd@lists.infradead.org Subject: [PATCH] JFFS2: Erase max 3 EB's in jffs2_write_super() Date: Tue, 2 Feb 2010 10:40:00 +0100 Message-Id: <1265103600-32522-1-git-send-email-Joakim.Tjernlund@transmode.se> X-Mailer: git-send-email 1.6.4.4 X-MIMETrack: Itemize by SMTP Server on sesr04/Transmode(Release 8.5.1|September 28, 2009) at 2010-02-02 10:40:02, Serialize by Router on sesr04/Transmode(Release 8.5.1|September 28, 2009) at 2010-02-02 10:40:02, Serialize complete at 2010-02-02 10:40:02 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100202_044054_466026_0DE2635B X-CRM114-Status: GOOD ( 10.69 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.2.5 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- _SUMMARY_ Cc: Joakim Tjernlund X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- 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); }