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 ec1db1e..2d9fe18 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 7654e87..96ef21e 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 a6597d6..b5f2189 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;
        }