aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/writev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/writev.c')
-rw-r--r--fs/jffs2/writev.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/fs/jffs2/writev.c b/fs/jffs2/writev.c
index f079f8388566..c638ae1008de 100644
--- a/fs/jffs2/writev.c
+++ b/fs/jffs2/writev.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: writev.c,v 1.6 2004/11/16 20:36:12 dwmw2 Exp $ 10 * $Id: writev.c,v 1.8 2005/09/09 15:11:58 havasi Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -42,9 +42,40 @@ static inline int mtd_fake_writev(struct mtd_info *mtd, const struct kvec *vecs,
42int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct kvec *vecs, 42int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct kvec *vecs,
43 unsigned long count, loff_t to, size_t *retlen) 43 unsigned long count, loff_t to, size_t *retlen)
44{ 44{
45 if (!jffs2_is_writebuffered(c)) {
46 if (jffs2_sum_active()) {
47 int res;
48 res = jffs2_sum_add_kvec(c, vecs, count, (uint32_t) to);
49 if (res) {
50 return res;
51 }
52 }
53 }
54
45 if (c->mtd->writev) 55 if (c->mtd->writev)
46 return c->mtd->writev(c->mtd, vecs, count, to, retlen); 56 return c->mtd->writev(c->mtd, vecs, count, to, retlen);
47 else 57 else {
48 return mtd_fake_writev(c->mtd, vecs, count, to, retlen); 58 return mtd_fake_writev(c->mtd, vecs, count, to, retlen);
59 }
49} 60}
50 61
62int jffs2_flash_direct_write(struct jffs2_sb_info *c, loff_t ofs, size_t len,
63 size_t *retlen, const u_char *buf)
64{
65 int ret;
66 ret = c->mtd->write(c->mtd, ofs, len, retlen, buf);
67
68 if (jffs2_sum_active()) {
69 struct kvec vecs[1];
70 int res;
71
72 vecs[0].iov_base = (unsigned char *) buf;
73 vecs[0].iov_len = len;
74
75 res = jffs2_sum_add_kvec(c, vecs, 1, (uint32_t) ofs);
76 if (res) {
77 return res;
78 }
79 }
80 return ret;
81}