From patchwork Wed Feb 1 03:36:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Torvalds X-Patchwork-Id: 138899 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (unknown [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 581171007D2 for ; Wed, 1 Feb 2012 14:38:12 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RsR09-0005BU-E0; Wed, 01 Feb 2012 03:36:53 +0000 Received: from mail-yw0-f49.google.com ([209.85.213.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RsR06-0005BD-A4 for linux-mtd@lists.infradead.org; Wed, 01 Feb 2012 03:36:51 +0000 Received: by yhjj56 with SMTP id j56so370952yhj.36 for ; Tue, 31 Jan 2012 19:36:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=uI8n+Ipgo6c7ZWHFpDPjRNaQX93CyRVEmetrW2PEpSg=; b=XpcCeG7kfQpUB80Q10O5Jr9x1X16+Vckn+tj8QkXj1GQdhpL+O79bVE5tVgE3lcXgN imZFJQxlp4DhGD2jJQ6ehmhhirhNvIZTgOjqaDrctD2KiozZSK/jmEdysFq3bwjLaF6E OPOGydIemyJHwcKUfIjqsB1m19IEMsbFHWefw= Received: by 10.236.191.35 with SMTP id f23mr15476633yhn.29.1328067408733; Tue, 31 Jan 2012 19:36:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.175.170 with HTTP; Tue, 31 Jan 2012 19:36:25 -0800 (PST) In-Reply-To: References: From: Linus Torvalds Date: Tue, 31 Jan 2012 19:36:25 -0800 X-Google-Sender-Auth: Q1cpHYLQLlDY6wh2W4t0xyGw81o Message-ID: Subject: Re: [GIT PULL] logfs: bug fixes To: Brian Norris X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.4 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.213.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (linus971[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (linus971[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 Cc: Artem Bityutskiy , Prasad Joshi , =?ISO-8859-1?Q?J=F6rn_Engel?= , David Woodhouse , linux-mtd@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list 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 On Tue, Jan 31, 2012 at 7:07 PM, Brian Norris wrote: > > For your (hopefully temporary) resolution, mtd_can_have_bb() should > return 1, not 0. Or better yet, do not change mtd_can_have_bb() right > now. Always returning 0 is interpreted as "the MTD cannot have bad > blocks," which is dangerous for MTD's that *do* support bad blocks. Right you are. That was just a thinko on my part. So together with the point that logfs should have dropped the use of mtd_can_have_bb(), the fix to that merge should be the attached patch - at least then things should hopefully work. That still leaves the question of whether the MTD people want to change the semantics in other ways. Sorry for the mis-merge, Linus fs/logfs/dev_mtd.c | 6 ------ include/linux/mtd/mtd.h | 2 +- 2 files changed, 1 insertions(+), 7 deletions(-) diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c index e97404d611e0..9c501449450d 100644 --- a/fs/logfs/dev_mtd.c +++ b/fs/logfs/dev_mtd.c @@ -152,9 +152,6 @@ static struct page *logfs_mtd_find_first_sb(struct super_block *sb, u64 *ofs) filler_t *filler = logfs_mtd_readpage; struct mtd_info *mtd = super->s_mtd; - if (!mtd_can_have_bb(mtd)) - return NULL; - *ofs = 0; while (mtd_block_isbad(mtd, *ofs)) { *ofs += mtd->erasesize; @@ -172,9 +169,6 @@ static struct page *logfs_mtd_find_last_sb(struct super_block *sb, u64 *ofs) filler_t *filler = logfs_mtd_readpage; struct mtd_info *mtd = super->s_mtd; - if (!mtd_can_have_bb(mtd)) - return NULL; - *ofs = mtd->size - mtd->erasesize; while (mtd_block_isbad(mtd, *ofs)) { *ofs -= mtd->erasesize; diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 221295208fd0..266e90dcee35 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -489,7 +489,7 @@ static inline int mtd_has_oob(const struct mtd_info *mtd) static inline int mtd_can_have_bb(const struct mtd_info *mtd) { - return 0; + return 1; } /* Kernel-side ioctl definitions */