Re: RFC: generalize jffs2_nand_flash_setup
Josh Boyer <[email protected]> Wed, 05 May 2004 06:47:43 -0500
| Newsgroups | gmane.linux.file-systems.jffs |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 2004-05-03 at 15:12, Josh Boyer wrote: > I'll try and get some better patches for tomorrow. Here's the latest patch. Thanks for the feedback. thx, josh
flash_setup.patch
(text/x-patch, 3 KB)
Index: fs/jffs2/fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.39
diff -a -u -r1.39 fs.c
--- fs/jffs2/fs.c 14 Apr 2004 12:57:54 -0000 1.39
+++ fs/jffs2/fs.c 4 May 2004 12:44:19 -0000
@@ -474,12 +474,10 @@
c->cleanmarker_size = sizeof(struct jffs2_unknown_node);
/* Joern -- stick alignment for weird 8-byte-page flash here */
- if (jffs2_cleanmarker_oob(c)) {
- /* NAND (or other bizarre) flash... do setup accordingly */
- ret = jffs2_nand_flash_setup(c);
- if (ret)
- return ret;
- }
+ /* NAND (or other bizarre) flash... do setup accordingly */
+ ret = jffs2_flash_setup(c);
+ if (ret)
+ return ret;
c->inocache_list = kmalloc(INOCACHE_HASHSIZE * sizeof(struct jffs2_inode_cache *), GFP_KERNEL);
if (!c->inocache_list) {
@@ -524,7 +522,7 @@
out_inohash:
kfree(c->inocache_list);
out_wbuf:
- jffs2_nand_flash_cleanup(c);
+ jffs2_flash_cleanup(c);
return ret;
}
@@ -623,4 +621,26 @@
kunmap(pg);
page_cache_release(pg);
+}
+
+int jffs2_flash_setup(struct jffs2_sb_info *c) {
+ int ret;
+
+ if (jffs2_cleanmarker_oob(c)) {
+ /* NAND flash... do setup accordingly */
+ ret = jffs2_nand_flash_setup(c);
+ if (ret)
+ return ret;
+ }
+
+ /* add setups for other bizarre flashes here... */
+}
+
+void jffs2_flash_cleanup(struct jffs2_sb_info *c) {
+
+ if (jffs2_cleanmarker_oob(c)) {
+ jffs2_nand_flash_cleanup(c);
+ }
+
+ /* add cleanups for other bizarre flashes here... */
}
Index: fs/jffs2/os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.41
diff -a -u -r1.41 os-linux.h
--- fs/jffs2/os-linux.h 26 Nov 2003 13:02:46 -0000 1.41
+++ fs/jffs2/os-linux.h 4 May 2004 12:44:19 -0000
@@ -193,6 +193,8 @@
void jffs2_gc_release_page(struct jffs2_sb_info *c,
unsigned char *pg,
unsigned long *priv);
+int jffs2_flash_setup(struct jffs2_sb_info *c);
+void jffs2_flash_cleanup(struct jffs2_sb_info *c);
/* writev.c */
Index: fs/jffs2/super-v24.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super-v24.c,v
retrieving revision 1.76
diff -a -u -r1.76 super-v24.c
--- fs/jffs2/super-v24.c 2 Mar 2004 08:53:02 -0000 1.76
+++ fs/jffs2/super-v24.c 4 May 2004 12:44:19 -0000
@@ -90,7 +90,7 @@
jffs2_free_ino_caches(c);
jffs2_free_raw_node_refs(c);
kfree(c->blocks);
- jffs2_nand_flash_cleanup(c);
+ jffs2_flash_cleanup(c);
kfree(c->inocache_list);
if (c->mtd->sync)
c->mtd->sync(c->mtd);
Index: fs/jffs2/super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.92
diff -a -u -r1.92 super.c
--- fs/jffs2/super.c 30 Mar 2004 13:01:40 -0000 1.92
+++ fs/jffs2/super.c 4 May 2004 12:44:19 -0000
@@ -266,7 +266,7 @@
jffs2_free_ino_caches(c);
jffs2_free_raw_node_refs(c);
kfree(c->blocks);
- jffs2_nand_flash_cleanup(c);
+ jffs2_flash_cleanup(c);
kfree(c->inocache_list);
if (c->mtd->sync)
c->mtd->sync(c->mtd);