[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: generalize jffs2_nand_flash_setup



On Thu, 2004-04-29 at 10:57, David Woodhouse wrote:
> It is, thanks. We want it for running on blkmtd devices too, where the
> backing store is actually a block device so we want to batch writes into
> 512-byte sectors even though we don't do ECC.

Great.  Below is a more complete patch for the generalization changes. 
Do you prefer patches, or is there some other way you would like changes
submitted?

josh


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 3 May 2004 12:06:30 -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;
}
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 3 May 2004 12:06:30 -0000
@@ -107,8 +107,8 @@
#define jffs2_flush_wbuf_gc(c, i) ({ (void)(c), (void) i, 0; })
#define jffs2_nand_read_failcnt(c,jeb) do { ; } while(0)
#define jffs2_write_nand_badblock(c,jeb) do { ; } while(0)
-#define jffs2_nand_flash_setup(c) (0)
-#define jffs2_nand_flash_cleanup(c) do {} while(0)
+#define jffs2_flash_setup(c) (0)
+#define jffs2_flash_cleanup(c) do {} while(0)
#define jffs2_wbuf_dirty(c) (0)
#define jffs2_flash_writev(a,b,c,d,e,f)
jffs2_flash_direct_writev(a,b,c,d,e)
#define jffs2_wbuf_timeout NULL
@@ -134,8 +134,8 @@
int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct
jffs2_eraseblock *jeb);
void jffs2_wbuf_timeout(unsigned long data);
void jffs2_wbuf_process(void *data);
-int jffs2_nand_flash_setup(struct jffs2_sb_info *c);
-void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c);
+int jffs2_flash_setup(struct jffs2_sb_info *c);
+void jffs2_flash_cleanup(struct jffs2_sb_info *c);
#endif /* NAND */

/* erase.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 3 May 2004 12:06:30 -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 3 May 2004 12:06:30 -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);
Index: fs/jffs2/wbuf.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/wbuf.c,v
retrieving revision 1.61
diff -a -u -r1.61 wbuf.c
--- fs/jffs2/wbuf.c 14 Apr 2004 19:01:51 -0000 1.61
+++ fs/jffs2/wbuf.c 3 May 2004 12:06:31 -0000
@@ -1112,7 +1112,7 @@



-int jffs2_nand_flash_setup(struct jffs2_sb_info *c)
+int jffs2_flash_setup(struct jffs2_sb_info *c)
{
/* Cleanmarker is out-of-band, so inline size zero */
c->cleanmarker_size = 0;
@@ -1178,7 +1178,7 @@
return 0;
}

-void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c)
+void jffs2_flash_cleanup(struct jffs2_sb_info *c)
{
kfree(c->wbuf);
}


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com