kernel: jffs2: ignore bad blocks after the end-of-filesystem marker
authorFelix Fietkau <nbd@openwrt.org>
Mon, 28 Oct 2013 16:06:47 +0000 (16:06 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 28 Oct 2013 16:06:47 +0000 (16:06 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 38568

target/linux/generic/patches-3.10/532-jffs2_eofdetect.patch
target/linux/generic/patches-3.12/532-jffs2_eofdetect.patch

index f36131e99fcfde6f2f2101f229e44ee5306ac376..269179063cd4373a8b004a50b2c3115b684c53fc 100644 (file)
        /* Now scan the directory tree, increasing nlink according to every dirent found. */
 --- a/fs/jffs2/scan.c
 +++ b/fs/jffs2/scan.c
-@@ -148,8 +148,11 @@ int jffs2_scan_medium(struct jffs2_sb_in
+@@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in
                /* reset summary info for next eraseblock scan */
                jffs2_sum_reset_collected(s);
  
 -              ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
 -                                              buf_size, s);
-+              if (c->flags & (1 << 7))
-+                      ret = BLK_STATE_ALLFF;
-+              else
++              if (c->flags & (1 << 7)) {
++                      if (mtd_block_isbad(c->mtd, jeb->offset))
++                              ret = BLK_STATE_BADBLOCK;
++                      else
++                              ret = BLK_STATE_ALLFF;
++              } else
 +                      ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
 +                                                      buf_size, s);
  
                if (ret < 0)
                        goto out;
-@@ -556,6 +559,17 @@ static int jffs2_scan_eraseblock (struct
+@@ -556,6 +562,17 @@ static int jffs2_scan_eraseblock (struct
                        return err;
        }
  
index f36131e99fcfde6f2f2101f229e44ee5306ac376..269179063cd4373a8b004a50b2c3115b684c53fc 100644 (file)
        /* Now scan the directory tree, increasing nlink according to every dirent found. */
 --- a/fs/jffs2/scan.c
 +++ b/fs/jffs2/scan.c
-@@ -148,8 +148,11 @@ int jffs2_scan_medium(struct jffs2_sb_in
+@@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in
                /* reset summary info for next eraseblock scan */
                jffs2_sum_reset_collected(s);
  
 -              ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
 -                                              buf_size, s);
-+              if (c->flags & (1 << 7))
-+                      ret = BLK_STATE_ALLFF;
-+              else
++              if (c->flags & (1 << 7)) {
++                      if (mtd_block_isbad(c->mtd, jeb->offset))
++                              ret = BLK_STATE_BADBLOCK;
++                      else
++                              ret = BLK_STATE_ALLFF;
++              } else
 +                      ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
 +                                                      buf_size, s);
  
                if (ret < 0)
                        goto out;
-@@ -556,6 +559,17 @@ static int jffs2_scan_eraseblock (struct
+@@ -556,6 +562,17 @@ static int jffs2_scan_eraseblock (struct
                        return err;
        }