aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/fs.c12
-rw-r--r--fs/jffs2/os-linux.h6
-rw-r--r--fs/jffs2/wbuf.c24
3 files changed, 42 insertions, 0 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 23029f42ae8c..1d3b7a9fc828 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -670,6 +670,13 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) {
670 return ret; 670 return ret;
671 } 671 }
672 672
673 /* and an UBI volume */
674 if (jffs2_ubivol(c)) {
675 ret = jffs2_ubivol_setup(c);
676 if (ret)
677 return ret;
678 }
679
673 return ret; 680 return ret;
674} 681}
675 682
@@ -688,4 +695,9 @@ void jffs2_flash_cleanup(struct jffs2_sb_info *c) {
688 if (jffs2_nor_wbuf_flash(c)) { 695 if (jffs2_nor_wbuf_flash(c)) {
689 jffs2_nor_wbuf_flash_cleanup(c); 696 jffs2_nor_wbuf_flash_cleanup(c);
690 } 697 }
698
699 /* and an UBI volume */
700 if (jffs2_ubivol(c)) {
701 jffs2_ubivol_cleanup(c);
702 }
691} 703}
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 2379c7e88735..80daea96bbc2 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -96,6 +96,9 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
96#define jffs2_nor_wbuf_flash(c) (0) 96#define jffs2_nor_wbuf_flash(c) (0)
97#define jffs2_nor_wbuf_flash_setup(c) (0) 97#define jffs2_nor_wbuf_flash_setup(c) (0)
98#define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0) 98#define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0)
99#define jffs2_ubivol(c) (0)
100#define jffs2_ubivol_setup(c) (0)
101#define jffs2_ubivol_cleanup(c) do {} while (0)
99 102
100#else /* NAND and/or ECC'd NOR support present */ 103#else /* NAND and/or ECC'd NOR support present */
101 104
@@ -131,6 +134,9 @@ void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c);
131#define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH) 134#define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH)
132int jffs2_dataflash_setup(struct jffs2_sb_info *c); 135int jffs2_dataflash_setup(struct jffs2_sb_info *c);
133void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); 136void jffs2_dataflash_cleanup(struct jffs2_sb_info *c);
137#define jffs2_ubivol(c) (c->mtd->type == MTD_UBIVOLUME)
138int jffs2_ubivol_setup(struct jffs2_sb_info *c);
139void jffs2_ubivol_cleanup(struct jffs2_sb_info *c);
134 140
135#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE)) 141#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE))
136int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c); 142int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index dafcd4102401..c556e85a565c 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1209,3 +1209,27 @@ int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) {
1209void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { 1209void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
1210 kfree(c->wbuf); 1210 kfree(c->wbuf);
1211} 1211}
1212
1213int jffs2_ubivol_setup(struct jffs2_sb_info *c) {
1214 c->cleanmarker_size = 0;
1215
1216 if (c->mtd->writesize == 1)
1217 /* We do not need write-buffer */
1218 return 0;
1219
1220 init_rwsem(&c->wbuf_sem);
1221
1222 c->wbuf_pagesize = c->mtd->writesize;
1223 c->wbuf_ofs = 0xFFFFFFFF;
1224 c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
1225 if (!c->wbuf)
1226 return -ENOMEM;
1227
1228 printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size);
1229
1230 return 0;
1231}
1232
1233void jffs2_ubivol_cleanup(struct jffs2_sb_info *c) {
1234 kfree(c->wbuf);
1235}