diff mbox

[GIT,PULL] logfs: bug fixes

Message ID CA+55aFwMinLTj4Jf5D-LHR73vfPLn4EUHooaBGSrsDdrRWsrrw@mail.gmail.com
State Accepted
Headers show

Commit Message

Linus Torvalds Feb. 1, 2012, 3:36 a.m. UTC
On Tue, Jan 31, 2012 at 7:07 PM, Brian Norris
<computersforpeace@gmail.com> 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
diff mbox

Patch

 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 */