From patchwork Wed Jun 1 10:06:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 98170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2D23CB6F6C for ; Wed, 1 Jun 2011 21:41:15 +1000 (EST) Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRiOX-0001Lf-OJ; Wed, 01 Jun 2011 10:11:22 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QRiOX-0002OL-EC; Wed, 01 Jun 2011 10:11:21 +0000 Received: from mail-ew0-f49.google.com ([209.85.215.49]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRiOT-0002MK-2j for linux-mtd@lists.infradead.org; Wed, 01 Jun 2011 10:11:18 +0000 Received: by ewy3 with SMTP id 3so2154931ewy.36 for ; Wed, 01 Jun 2011 03:11:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:reply-to:to:cc:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=Lba9gKwZ9jgvHaQNvmDdYl7pYzEIgdY95Zv38LGaoIY=; b=HTxSIPLLNb9linbeP1qBqvs7NBvhd7eC3yjUmpn+PbWDbG56w9aqcxcFhvsastrbtJ lqAmkzqC3+ymfiz3Oc2LsjrSQKZlD62be2Bf1N34SUk90nFtdWFxwF5Mgjx68XVo1nil s/edrluptGEuyGOMlIiLYGM8Yo2s4hk/6n3Qk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:reply-to:to:cc:in-reply-to:references:content-type :date:message-id:mime-version:x-mailer:content-transfer-encoding; b=HxoJ8EKpHKw0fyvc0nRHbdh0xkcwiX8qorjI0qT0wLnO8W/HEj0jW1Qd1/ZIA1MUvU 2YSgHZOxWOk5wbZNnKWxSpFnpvhUVQ+Mwl83vEYQ6EzKPOojHnpMBWlpX+Cz76z+AgbI xkxbjLCZt3qwa/3cYcXwFQGsLywI5CND8Yqnc= Received: by 10.14.10.69 with SMTP id 45mr2877243eeu.33.1306923074680; Wed, 01 Jun 2011 03:11:14 -0700 (PDT) Received: from ?IPv6:::1? (shutemov.name [188.40.19.243]) by mx.google.com with ESMTPS id a45sm602438eec.23.2011.06.01.03.11.12 (version=SSLv3 cipher=OTHER); Wed, 01 Jun 2011 03:11:13 -0700 (PDT) Subject: Re: [PATCH 2/3] UBIFS: intialize the LPT earlier From: Artem Bityutskiy To: Ben Gardiner In-Reply-To: References: Date: Wed, 01 Jun 2011 13:06:50 +0300 Message-ID: <1306922810.4405.91.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 (2.32.2-1.fc14) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110601_061117_573382_3DCB1342 X-CRM114-Status: GOOD ( 20.72 ) X-Spam-Score: 1.4 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (dedekind1[at]gmail.com) 2.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, "Matthew L. Creech" X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi, thanks for the patch, however On Mon, 2011-05-30 at 14:56 -0400, Ben Gardiner wrote: > + err = ubifs_lpt_init(c, 1, !c->ro_mount); > + if (err) > + goto out_lpt; You cannot call ubifs_lpt_init() > + > if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { > ubifs_msg("recovery needed"); > c->need_recovery = 1; > if (!c->ro_mount) { > err = ubifs_recover_inl_heads(c, c->sbuf); Before ubifs_recover_inl_heads() is called in case of dirty FS. I've massaged your patch and pushed the following analogous patch to the ubifs tree, please check/test: From 678ef9ad3daa453723f04f84f9db6a22994e7343 Mon Sep 17 00:00:00 2001 From: Ben Gardiner Date: Mon, 30 May 2011 14:56:15 -0400 Subject: [PATCH] UBIFS: intialize LPT earlier The current 'mount_ubifs()' implementation does not initialize the LPT until the the master node is marked dirty. Move the LPT initialization to before marking the master node dirty. This is a preparation for the next patch which will move the free-space-fixup check to before marking the master node dirty, because we have to fix-up the free space before doing any writes. Artem: massaged the patch and commit message. Signed-off-by: Ben Gardiner Signed-off-by: Artem Bityutskiy --- fs/ubifs/super.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 1e40db7..6d357fd 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1282,17 +1282,24 @@ static int mount_ubifs(struct ubifs_info *c) if (err) goto out_master; - init_constants_master(c); - if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { ubifs_msg("recovery needed"); c->need_recovery = 1; - if (!c->ro_mount) { - err = ubifs_recover_inl_heads(c, c->sbuf); - if (err) - goto out_master; - } - } else if (!c->ro_mount) { + } + + init_constants_master(c); + + if (c->need_recovery && !c->ro_mount) { + err = ubifs_recover_inl_heads(c, c->sbuf); + if (err) + goto out_master; + } + + err = ubifs_lpt_init(c, 1, !c->ro_mount); + if (err) + goto out_master; + + if (!c->ro_mount) { /* * Set the "dirty" flag so that if we reboot uncleanly we * will notice this immediately on the next mount. @@ -1300,13 +1307,9 @@ static int mount_ubifs(struct ubifs_info *c) c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY); err = ubifs_write_master(c); if (err) - goto out_master; + goto out_lpt; } - err = ubifs_lpt_init(c, 1, !c->ro_mount); - if (err) - goto out_lpt; - err = dbg_check_idx_size(c, c->bi.old_idx_sz); if (err) goto out_lpt;