]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fs: jffs2: make jffs2 work zero oobavail
authorLothar Waßmann <LW@KARO-electronics.de>
Tue, 5 Nov 2013 21:54:05 +0000 (22:54 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 5 Nov 2013 21:54:05 +0000 (22:54 +0100)
drivers/mtd/nand/nand_base.c
fs/jffs2/scan.c
fs/jffs2/wbuf.c

index ec1db1e19c053367c61a5428319c21f49ad44a5d..2d9fe18e58c640e9a364ad065cc58360421dd1c4 100644 (file)
@@ -1741,6 +1741,9 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
        else
                len = mtd->oobsize;
 
+       if (len == 0)
+               return 0;
+
        if (unlikely(ops->ooboffs >= len)) {
                pr_debug("%s: attempt to start read outside oob\n",
                                __func__);
@@ -2409,6 +2412,9 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to,
        else
                len = mtd->oobsize;
 
+       if (len == 0)
+               return 0;
+
        /* Do not allow write past end of page */
        if ((ops->ooboffs + ops->ooblen) > len) {
                pr_debug("%s: attempt to write past end of page\n",
index 7654e87b042869ef43aff269a10e88a4088d59c3..96ef21eff62b85ccdd1c5f37478a8a9802d2e031 100644 (file)
@@ -113,7 +113,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
        if (!flashbuf) {
                /* For NAND it's quicker to read a whole eraseblock at a time,
                   apparently */
-               if (jffs2_cleanmarker_oob(c))
+               if (c->mtd->type == MTD_NANDFLASH)
                        try_size = c->sector_size;
                else
                        try_size = PAGE_SIZE;
@@ -459,7 +459,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
        jffs2_dbg(1, "%s(): Scanning block at 0x%x\n", __func__, ofs);
 
 #ifdef CONFIG_JFFS2_FS_WRITEBUFFER
-       if (jffs2_cleanmarker_oob(c)) {
+       if (c->mtd->type == MTD_NANDFLASH) {
                int ret;
 
                if (mtd_block_isbad(c->mtd, jeb->offset))
index a6597d60d76de751224243ddfe6d990cd6de7e87..b5f218903d7bf826db8aa8f06b1f543ddf24f6d1 100644 (file)
@@ -1200,7 +1200,7 @@ int jffs2_nand_flash_setup(struct jffs2_sb_info *c)
        /* Cleanmarker is out-of-band, so inline size zero */
        c->cleanmarker_size = 0;
 
-       if (!oinfo || oinfo->oobavail == 0) {
+       if (!oinfo /* || oinfo->oobavail == 0 */) {
                pr_err("inconsistent device description\n");
                return -EINVAL;
        }