aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-24 05:01:43 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-24 05:01:43 -0400
commit0305c8659ff9cebabf469d5cd0ab8dc384857e10 (patch)
tree1784b2bb078a58e50ca75dfccd1e9fc5f8b211b8 /fs/jffs2
parent99988f7bbd16b861590dda4631c4db6cb17b5091 (diff)
parentd470a97c70a43ffafd6e728c913254b6d6fd1219 (diff)
Merge branch 'master' of git://git.infradead.org/~gleixner/mtd-nand-2.6.git
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/wbuf.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 0d7abb260489..1871140e1e78 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -236,10 +236,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
236 } 236 }
237 237
238 /* Do the read... */ 238 /* Do the read... */
239 if (jffs2_cleanmarker_oob(c)) 239 ret = c->mtd->read(c->mtd, start, c->wbuf_ofs - start, &retlen, buf);
240 ret = c->mtd->read_ecc(c->mtd, start, c->wbuf_ofs - start, &retlen, buf, NULL, c->oobinfo);
241 else
242 ret = c->mtd->read(c->mtd, start, c->wbuf_ofs - start, &retlen, buf);
243 240
244 if (ret == -EBADMSG && retlen == c->wbuf_ofs - start) { 241 if (ret == -EBADMSG && retlen == c->wbuf_ofs - start) {
245 /* ECC recovered */ 242 /* ECC recovered */
@@ -293,16 +290,13 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
293 if (breakme++ == 20) { 290 if (breakme++ == 20) {
294 printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs); 291 printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs);
295 breakme = 0; 292 breakme = 0;
296 c->mtd->write_ecc(c->mtd, ofs, towrite, &retlen, 293 c->mtd->write(c->mtd, ofs, towrite, &retlen,
297 brokenbuf, NULL, c->oobinfo); 294 brokenbuf);
298 ret = -EIO; 295 ret = -EIO;
299 } else 296 } else
300#endif 297#endif
301 if (jffs2_cleanmarker_oob(c)) 298 ret = c->mtd->write(c->mtd, ofs, towrite, &retlen,
302 ret = c->mtd->write_ecc(c->mtd, ofs, towrite, &retlen, 299 rewrite_buf);
303 rewrite_buf, NULL, c->oobinfo);
304 else
305 ret = c->mtd->write(c->mtd, ofs, towrite, &retlen, rewrite_buf);
306 300
307 if (ret || retlen != towrite) { 301 if (ret || retlen != towrite) {
308 /* Argh. We tried. Really we did. */ 302 /* Argh. We tried. Really we did. */
@@ -455,15 +449,12 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
455 if (breakme++ == 20) { 449 if (breakme++ == 20) {
456 printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs); 450 printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs);
457 breakme = 0; 451 breakme = 0;
458 c->mtd->write_ecc(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, 452 c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen,
459 &retlen, brokenbuf, NULL, c->oobinfo); 453 brokenbuf);
460 ret = -EIO; 454 ret = -EIO;
461 } else 455 } else
462#endif 456#endif
463 457
464 if (jffs2_cleanmarker_oob(c))
465 ret = c->mtd->write_ecc(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf, NULL, c->oobinfo);
466 else
467 ret = c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf); 458 ret = c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf);
468 459
469 if (ret || retlen != c->wbuf_pagesize) { 460 if (ret || retlen != c->wbuf_pagesize) {
@@ -792,10 +783,7 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re
792 783
793 /* Read flash */ 784 /* Read flash */
794 down_read(&c->wbuf_sem); 785 down_read(&c->wbuf_sem);
795 if (jffs2_cleanmarker_oob(c)) 786 ret = c->mtd->read(c->mtd, ofs, len, retlen, buf);
796 ret = c->mtd->read_ecc(c->mtd, ofs, len, retlen, buf, NULL, c->oobinfo);
797 else
798 ret = c->mtd->read(c->mtd, ofs, len, retlen, buf);
799 787
800 if ( (ret == -EBADMSG) && (*retlen == len) ) { 788 if ( (ret == -EBADMSG) && (*retlen == len) ) {
801 printk(KERN_WARNING "mtd->read(0x%zx bytes from 0x%llx) returned ECC error\n", 789 printk(KERN_WARNING "mtd->read(0x%zx bytes from 0x%llx) returned ECC error\n",