aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2011-12-23 10:35:41 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:25:20 -0500
commiteda95cbf75193808f62948fb0142ba0901d8bee2 (patch)
tree047bcfa05bc118b1d34327b3e62fa1d10d4bcb43 /fs
parent329ad399a9b3adf52c90637b21ca029fcf7f8795 (diff)
mtd: introduce mtd_write interface
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/wbuf.c18
-rw-r--r--fs/jffs2/writev.c5
-rw-r--r--fs/logfs/dev_mtd.c2
3 files changed, 13 insertions, 12 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index a24d3d21b63d..3ea2f8db9358 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -414,13 +414,12 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
414 if (breakme++ == 20) { 414 if (breakme++ == 20) {
415 printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs); 415 printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs);
416 breakme = 0; 416 breakme = 0;
417 c->mtd->write(c->mtd, ofs, towrite, &retlen, 417 mtd_write(c->mtd, ofs, towrite, &retlen, brokenbuf);
418 brokenbuf);
419 ret = -EIO; 418 ret = -EIO;
420 } else 419 } else
421#endif 420#endif
422 ret = c->mtd->write(c->mtd, ofs, towrite, &retlen, 421 ret = mtd_write(c->mtd, ofs, towrite, &retlen,
423 rewrite_buf); 422 rewrite_buf);
424 423
425 if (ret || retlen != towrite || jffs2_verify_write(c, rewrite_buf, ofs)) { 424 if (ret || retlen != towrite || jffs2_verify_write(c, rewrite_buf, ofs)) {
426 /* Argh. We tried. Really we did. */ 425 /* Argh. We tried. Really we did. */
@@ -620,13 +619,14 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
620 if (breakme++ == 20) { 619 if (breakme++ == 20) {
621 printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs); 620 printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs);
622 breakme = 0; 621 breakme = 0;
623 c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, 622 mtd_write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen,
624 brokenbuf); 623 brokenbuf);
625 ret = -EIO; 624 ret = -EIO;
626 } else 625 } else
627#endif 626#endif
628 627
629 ret = c->mtd->write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, c->wbuf); 628 ret = mtd_write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize,
629 &retlen, c->wbuf);
630 630
631 if (ret) { 631 if (ret) {
632 printk(KERN_WARNING "jffs2_flush_wbuf(): Write failed with %d\n", ret); 632 printk(KERN_WARNING "jffs2_flush_wbuf(): Write failed with %d\n", ret);
@@ -862,8 +862,8 @@ int jffs2_flash_writev(struct jffs2_sb_info *c, const struct kvec *invecs,
862 v += wbuf_retlen; 862 v += wbuf_retlen;
863 863
864 if (vlen >= c->wbuf_pagesize) { 864 if (vlen >= c->wbuf_pagesize) {
865 ret = c->mtd->write(c->mtd, outvec_to, PAGE_DIV(vlen), 865 ret = mtd_write(c->mtd, outvec_to, PAGE_DIV(vlen),
866 &wbuf_retlen, v); 866 &wbuf_retlen, v);
867 if (ret < 0 || wbuf_retlen != PAGE_DIV(vlen)) 867 if (ret < 0 || wbuf_retlen != PAGE_DIV(vlen))
868 goto outfile; 868 goto outfile;
869 869
diff --git a/fs/jffs2/writev.c b/fs/jffs2/writev.c
index b9276b11bac6..b05710fd552a 100644
--- a/fs/jffs2/writev.c
+++ b/fs/jffs2/writev.c
@@ -26,7 +26,8 @@ static inline int mtd_fake_writev(struct mtd_info *mtd, const struct kvec *vecs,
26 for (i=0; i<count; i++) { 26 for (i=0; i<count; i++) {
27 if (!vecs[i].iov_len) 27 if (!vecs[i].iov_len)
28 continue; 28 continue;
29 ret = mtd->write(mtd, to, vecs[i].iov_len, &thislen, vecs[i].iov_base); 29 ret = mtd_write(mtd, to, vecs[i].iov_len, &thislen,
30 vecs[i].iov_base);
30 totlen += thislen; 31 totlen += thislen;
31 if (ret || thislen != vecs[i].iov_len) 32 if (ret || thislen != vecs[i].iov_len)
32 break; 33 break;
@@ -61,7 +62,7 @@ int jffs2_flash_direct_write(struct jffs2_sb_info *c, loff_t ofs, size_t len,
61 size_t *retlen, const u_char *buf) 62 size_t *retlen, const u_char *buf)
62{ 63{
63 int ret; 64 int ret;
64 ret = c->mtd->write(c->mtd, ofs, len, retlen, buf); 65 ret = mtd_write(c->mtd, ofs, len, retlen, buf);
65 66
66 if (jffs2_sum_active()) { 67 if (jffs2_sum_active()) {
67 struct kvec vecs[1]; 68 struct kvec vecs[1];
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index 3ee64351685f..1842440d6564 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -49,7 +49,7 @@ static int loffs_mtd_write(struct super_block *sb, loff_t ofs, size_t len,
49 BUG_ON(len > PAGE_CACHE_SIZE); 49 BUG_ON(len > PAGE_CACHE_SIZE);
50 page_start = ofs & PAGE_CACHE_MASK; 50 page_start = ofs & PAGE_CACHE_MASK;
51 page_end = PAGE_CACHE_ALIGN(ofs + len) - 1; 51 page_end = PAGE_CACHE_ALIGN(ofs + len) - 1;
52 ret = mtd->write(mtd, ofs, len, &retlen, buf); 52 ret = mtd_write(mtd, ofs, len, &retlen, buf);
53 if (ret || (retlen != len)) 53 if (ret || (retlen != len))
54 return -EIO; 54 return -EIO;
55 55