aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 13:42:35 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 13:42:35 -0400
commitb928ed56182b8ea59bd43f2d5b865f13a54d5719 (patch)
treee9ba0ff9d316bdb84d6f2718d4543fd4213ba061 /fs
parentea6db58f3ea55f413c882095d2afaea8137f4f8c (diff)
parentd468a030026017008286919aa6127b1190efb2c2 (diff)
Merge branch 'for-linus' of git://git.infradead.org/ubi-2.6
* 'for-linus' of git://git.infradead.org/ubi-2.6: UBI: remove unused variable UBI: add me to MAINTAINERS JFFS2: add UBI support UBI: Unsorted Block Images
Diffstat (limited to 'fs')
-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 abb90c0c09cc..8a649f602767 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -672,6 +672,13 @@ static int jffs2_flash_setup(struct jffs2_sb_info *c) {
672 return ret; 672 return ret;
673 } 673 }
674 674
675 /* and an UBI volume */
676 if (jffs2_ubivol(c)) {
677 ret = jffs2_ubivol_setup(c);
678 if (ret)
679 return ret;
680 }
681
675 return ret; 682 return ret;
676} 683}
677 684
@@ -690,4 +697,9 @@ void jffs2_flash_cleanup(struct jffs2_sb_info *c) {
690 if (jffs2_nor_wbuf_flash(c)) { 697 if (jffs2_nor_wbuf_flash(c)) {
691 jffs2_nor_wbuf_flash_cleanup(c); 698 jffs2_nor_wbuf_flash_cleanup(c);
692 } 699 }
700
701 /* and an UBI volume */
702 if (jffs2_ubivol(c)) {
703 jffs2_ubivol_cleanup(c);
704 }
693} 705}
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index e07a0edcdb4f..8d92e45168ca 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -98,6 +98,9 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
98#define jffs2_nor_wbuf_flash(c) (0) 98#define jffs2_nor_wbuf_flash(c) (0)
99#define jffs2_nor_wbuf_flash_setup(c) (0) 99#define jffs2_nor_wbuf_flash_setup(c) (0)
100#define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0) 100#define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0)
101#define jffs2_ubivol(c) (0)
102#define jffs2_ubivol_setup(c) (0)
103#define jffs2_ubivol_cleanup(c) do {} while (0)
101 104
102#else /* NAND and/or ECC'd NOR support present */ 105#else /* NAND and/or ECC'd NOR support present */
103 106
@@ -133,6 +136,9 @@ void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c);
133#define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH) 136#define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH)
134int jffs2_dataflash_setup(struct jffs2_sb_info *c); 137int jffs2_dataflash_setup(struct jffs2_sb_info *c);
135void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); 138void jffs2_dataflash_cleanup(struct jffs2_sb_info *c);
139#define jffs2_ubivol(c) (c->mtd->type == MTD_UBIVOLUME)
140int jffs2_ubivol_setup(struct jffs2_sb_info *c);
141void jffs2_ubivol_cleanup(struct jffs2_sb_info *c);
136 142
137#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE)) 143#define jffs2_nor_wbuf_flash(c) (c->mtd->type == MTD_NORFLASH && ! (c->mtd->flags & MTD_BIT_WRITEABLE))
138int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c); 144int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 4fac6dd53954..ab86031b3c07 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -1208,3 +1208,27 @@ int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c) {
1208void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) { 1208void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
1209 kfree(c->wbuf); 1209 kfree(c->wbuf);
1210} 1210}
1211
1212int jffs2_ubivol_setup(struct jffs2_sb_info *c) {
1213 c->cleanmarker_size = 0;
1214
1215 if (c->mtd->writesize == 1)
1216 /* We do not need write-buffer */
1217 return 0;
1218
1219 init_rwsem(&c->wbuf_sem);
1220
1221 c->wbuf_pagesize = c->mtd->writesize;
1222 c->wbuf_ofs = 0xFFFFFFFF;
1223 c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
1224 if (!c->wbuf)
1225 return -ENOMEM;
1226
1227 printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size);
1228
1229 return 0;
1230}
1231
1232void jffs2_ubivol_cleanup(struct jffs2_sb_info *c) {
1233 kfree(c->wbuf);
1234}