mtd/fs/jffs2 fs.c, 1.71, 1.72 os-linux.h, 1.67, 1.68 wbuf.c, 1.109, 1.110

David Woodhouse dwmw2 at infradead.org
Thu Feb 9 11:13:38 EST 2006


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv28919

Modified Files:
	fs.c os-linux.h wbuf.c 
Log Message:
wbuf on block2mtd

Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- fs.c	11 Dec 2005 14:07:39 -0000	1.71
+++ fs.c	9 Feb 2006 16:13:35 -0000	1.72
@@ -657,6 +657,13 @@
 			return ret;
 	}
 
+	/* and MTD-on-blockdevice */
+	if (jffs2_block_mtd(c)) {
+		ret = jffs2_block_mtd_setup(c);
+		if (ret)
+			return ret;
+	}
+
 	return ret;
 }
 
@@ -680,4 +687,9 @@
 	if (jffs2_nor_wbuf_flash(c)) {
 		jffs2_nor_wbuf_flash_cleanup(c);
 	}
+
+	/* and MTD-on-blockdevice */
+	if (jffs2_block_mtd(c)) {
+		jffs2_block_mtd_cleanup(c);
+	}
 }

Index: os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- os-linux.h	11 Nov 2005 14:29:12 -0000	1.67
+++ os-linux.h	9 Feb 2006 16:13:35 -0000	1.68
@@ -93,12 +93,15 @@
 #define jffs2_nor_ecc(c) (0)
 #define jffs2_dataflash(c) (0)
 #define jffs2_nor_wbuf_flash(c) (0)
+#define jffs2_block_mtd(c) (0)
 #define jffs2_nor_ecc_flash_setup(c) (0)
 #define jffs2_nor_ecc_flash_cleanup(c) do {} while (0)
 #define jffs2_dataflash_setup(c) (0)
 #define jffs2_dataflash_cleanup(c) do {} while (0)
 #define jffs2_nor_wbuf_flash_setup(c) (0)
 #define jffs2_nor_wbuf_flash_cleanup(c) do {} while (0)
+#define jffs2_block_mtd_setup(c) (0)
+#define jffs2_block_mtd_cleanup(c) do {} while (0)
 
 #else /* NAND and/or ECC'd NOR support present */
 
@@ -146,6 +149,9 @@
 int jffs2_nor_wbuf_flash_setup(struct jffs2_sb_info *c);
 void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c);
 
+#define jffs2_block_mtd(c) (c->mtd->type == MTD_BLOCK)
+int jffs2_block_mtd_setup(struct jffs2_sb_info *c);
+void jffs2_block_mtd_cleanup(struct jffs2_sb_info *c);
 #endif /* WRITEBUFFER */
 
 /* erase.c */

Index: wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- wbuf.c	21 Jan 2006 21:50:44 -0000	1.109
+++ wbuf.c	9 Feb 2006 16:13:35 -0000	1.110
@@ -1348,3 +1348,25 @@
 void jffs2_nor_wbuf_flash_cleanup(struct jffs2_sb_info *c) {
 	kfree(c->wbuf);
 }
+
+int jffs2_block_mtd_setup(struct jffs2_sb_info *c) {
+	/* Use a 512-byte sector as wbuf region, for performance */
+	/* Cleanmarker currently occupies a whole programming region */
+	c->cleanmarker_size = 512;
+	c->ebh_size = 512;
+
+	/* Initialize write buffer */
+	init_rwsem(&c->wbuf_sem);
+	c->wbuf_pagesize = 512;
+	c->wbuf_ofs = 0xFFFFFFFF;
+
+	c->wbuf = kmalloc(c->wbuf_pagesize, GFP_KERNEL);
+	if (!c->wbuf)
+		return -ENOMEM;
+
+	return 0;
+}
+
+void jffs2_block_mtd_cleanup(struct jffs2_sb_info *c) {
+	kfree(c->wbuf);
+}





More information about the linux-mtd-cvs mailing list