From patchwork Wed Feb 1 09:10:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 138925 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 BD5A2B6EEE for ; Wed, 1 Feb 2012 20:10:11 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RsWBY-0000Sc-3J; Wed, 01 Feb 2012 09:09:00 +0000 Received: from mga01.intel.com ([192.55.52.88]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RsWBU-0000SM-5C for linux-mtd@lists.infradead.org; Wed, 01 Feb 2012 09:08:57 +0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 01 Feb 2012 01:08:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="asc'?diff'?scan'208";a="119010215" Received: from sauron.fi.intel.com (HELO [10.237.72.160]) ([10.237.72.160]) by fmsmga002.fm.intel.com with ESMTP; 01 Feb 2012 01:08:52 -0800 Message-ID: <1328087455.28171.77.camel@sauron.fi.intel.com> Subject: Re: [GIT PULL] logfs: bug fixes From: Artem Bityutskiy To: Linus Torvalds Date: Wed, 01 Feb 2012 11:10:55 +0200 In-Reply-To: References: Organization: Intel OTC X-Mailer: Evolution 3.2.3 (3.2.3-1.fc16) Mime-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.55.52.88 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-mtd@lists.infradead.org, Prasad Joshi , =?ISO-8859-1?Q?J=F6rn?= Engel , David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: artem.bityutskiy@linux.intel.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 On Tue, 2012-01-31 at 09:46 -0800, Linus Torvalds wrote: > Some uses may care about that "does it support bad blocks explicitly", > but nobody should ever care about "can_have_bb()". Possibly somebody > could care about the "inverse", in the sense that some filesystem > might want to only support devices that are defined to be perfect, but > that doesn't sound much like a MTD filesystem. Hi Linus, apologies for the hassle, this should have been dealt with in linux-next, I agree. I agree with your 'mtd_block_isbad()' change which now returns 0 if the underlying flash does not support bad blocks. This is cleaner and imposes less job on the MTD API users. This semantic change needs some additional clean-up work which is not critical though and will be dealt with normally during the v3.4 merge window. This whole API rework is going to continue and there will be many changes - only the first step is merged now. Just an example of the clean-up we need after your conflict resolution. diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c index e97404d..9c50144 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 2212952..887ebe3 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 !!mtd->block_isbad; } /* Kernel-side ioctl definitions */