aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/wbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/wbuf.c')
-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 916c87d3393b..76d4c361ef1f 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -233,10 +233,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
233 } 233 }
234 234
235 /* Do the read... */ 235 /* Do the read... */
236 if (jffs2_cleanmarker_oob(c)) 236 ret = c->mtd->read(c->mtd, start, c->wbuf_ofs - start, &retlen, buf);
237 ret = c->mtd->read_ecc(c->mtd, start, c->wbuf_ofs - start, &retlen, buf, NULL, c->oobinfo);
238 else
239 ret = c->mtd->read(c->mtd, start, c->wbuf_ofs - start, &retlen, buf);
240 237
241 if (ret == -EBADMSG && retlen == c->wbuf_ofs - start) { 238 if (ret == -EBADMSG && retlen == c->wbuf_ofs - start) {
242 /* ECC recovered */ 239 /* ECC recovered */
@@ -290,16 +287,13 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
290 if (breakme++ == 20) { 287 if (breakme++ == 20) {
291 printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs); 288 printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs);
292 breakme = 0; 289 breakme = 0;
293 c->mtd->write_ecc(c->mtd, ofs, towrite, &retlen, 290 c->mtd->write(c->mtd, ofs, towrite, &retlen,
294 brokenbuf, NULL, c->oobinfo); 291 brokenbuf);
295 ret = -EIO; 292 ret = -EIO;
296 } else 293 } else
297#endif 294#endif
298 if (jffs2_cleanmarker_oob(c)) 295 ret = c->mtd->write(c->mtd, ofs, towrite, &retlen,
299 ret = c->mtd->write_ecc(c->mtd, ofs, towrite, &retlen, 296 rewrite_buf);
300 rewrite_buf, NULL, c->oobinfo);
301 else
302 ret = c->mtd->write(c->mtd, ofs, towrite, &retlen, rewrite_buf);
303 297
304 if (ret || retlen != towrite) { 298 if (ret || retlen != towrite) {
305 /* Argh. We tried. Really we did. */ 299 /* Argh. We tried. Really we did. */
@@ -457,15 +451,12 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
457 if (breakme++ == 20) { 451 if (breakme++ == 20) {
458 printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs); 452 printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs);
459 breakme = 0; 453 breakme = 0;
460 c->mtd->write_ecc(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, 454 c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen,
461 &retlen, brokenbuf, NULL, c->oobinfo); 455 brokenbuf);
462 ret = -EIO; 456 ret = -EIO;
463 } else 457 } else
464#endif 458#endif
465 459
466 if (jffs2_cleanmarker_oob(c))
467 ret = c->mtd->write_ecc(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf, NULL, c->oobinfo);
468 else
469 ret = c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf); 460 ret = c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf);
470 461
471 if (ret || retlen != c->wbuf_pagesize) { 462 if (ret || retlen != c->wbuf_pagesize) {
@@ -800,10 +791,7 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re
800 791
801 /* Read flash */ 792 /* Read flash */
802 down_read(&c->wbuf_sem); 793 down_read(&c->wbuf_sem);
803 if (jffs2_cleanmarker_oob(c)) 794 ret = c->mtd->read(c->mtd, ofs, len, retlen, buf);
804 ret = c->mtd->read_ecc(c->mtd, ofs, len, retlen, buf, NULL, c->oobinfo);
805 else
806 ret = c->mtd->read(c->mtd, ofs, len, retlen, buf);
807 795
808 if ( (ret == -EBADMSG) && (*retlen == len) ) { 796 if ( (ret == -EBADMSG) && (*retlen == len) ) {
809 printk(KERN_WARNING "mtd->read(0x%zx bytes from 0x%llx) returned ECC error\n", 797 printk(KERN_WARNING "mtd->read(0x%zx bytes from 0x%llx) returned ECC error\n",