aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2005-02-09 04:24:26 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 06:29:43 -0400
commit2f82ce1eb637c06dfc60f095cd1891ae0ba4894c (patch)
tree425727d05f70fdd55d5cf715c7acbeca6aeeeb18 /fs/jffs2
parent8f15fd55f9bf266139b10850947e19c4e3f4e9b7 (diff)
[JFFS2] Use a single config option for write buffer support
This patch replaces the current CONFIG_JFFS2_FS_NAND, CONFIG_JFFS2_FS_NOR_ECC and CONFIG_JFFS2_FS_DATAFLASH with a single configuration option - CONFIG_JFFS2_FS_WRITEBUFFER. The only functional change of this patch is that the slower div/mod calculations for SECTOR_ADDR(), PAGE_DIV() and PAGE_MOD() are now always used when CONFIG_JFFS2_FS_WRITEBUFFER is enabled. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2')
-rw-r--r--fs/jffs2/Makefile6
-rw-r--r--fs/jffs2/fs.c6
-rw-r--r--fs/jffs2/nodelist.h4
-rw-r--r--fs/jffs2/os-linux.h28
-rw-r--r--fs/jffs2/scan.c12
-rw-r--r--fs/jffs2/super.c4
-rw-r--r--fs/jffs2/wbuf.c8
7 files changed, 24 insertions, 44 deletions
diff --git a/fs/jffs2/Makefile b/fs/jffs2/Makefile
index 6c2ebe176b40..f1afe681ecd6 100644
--- a/fs/jffs2/Makefile
+++ b/fs/jffs2/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the Linux Journalling Flash File System v2 (JFFS2) 2# Makefile for the Linux Journalling Flash File System v2 (JFFS2)
3# 3#
4# $Id: Makefile.common,v 1.8 2005/02/09 09:17:40 pavlov Exp $ 4# $Id: Makefile.common,v 1.9 2005/02/09 09:23:53 pavlov Exp $
5# 5#
6 6
7obj-$(CONFIG_JFFS2_FS) += jffs2.o 7obj-$(CONFIG_JFFS2_FS) += jffs2.o
@@ -11,9 +11,7 @@ jffs2-y += read.o nodemgmt.o readinode.o write.o scan.o gc.o
11jffs2-y += symlink.o build.o erase.o background.o fs.o writev.o 11jffs2-y += symlink.o build.o erase.o background.o fs.o writev.o
12jffs2-y += super.o 12jffs2-y += super.o
13 13
14jffs2-$(CONFIG_JFFS2_FS_NAND) += wbuf.o 14jffs2-$(CONFIG_JFFS2_FS_WRITEBUFFER) += wbuf.o
15jffs2-$(CONFIG_JFFS2_FS_NOR_ECC) += wbuf.o
16jffs2-$(CONFIG_JFFS2_FS_DATAFLASH) += wbuf.o
17jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rubin.o 15jffs2-$(CONFIG_JFFS2_RUBIN) += compr_rubin.o
18jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o 16jffs2-$(CONFIG_JFFS2_RTIME) += compr_rtime.o
19jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o 17jffs2-$(CONFIG_JFFS2_ZLIB) += compr_zlib.o
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 5b7c960a0475..c91c66e5e869 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: fs.c,v 1.52 2005/02/09 09:17:40 pavlov Exp $ 10 * $Id: fs.c,v 1.53 2005/02/09 09:23:53 pavlov Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -450,13 +450,11 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
450 450
451 c = JFFS2_SB_INFO(sb); 451 c = JFFS2_SB_INFO(sb);
452 452
453#ifndef CONFIG_JFFS2_FS_NAND 453#ifndef CONFIG_JFFS2_FS_WRITEBUFFER
454 if (c->mtd->type == MTD_NANDFLASH) { 454 if (c->mtd->type == MTD_NANDFLASH) {
455 printk(KERN_ERR "jffs2: Cannot operate on NAND flash unless jffs2 NAND support is compiled in.\n"); 455 printk(KERN_ERR "jffs2: Cannot operate on NAND flash unless jffs2 NAND support is compiled in.\n");
456 return -EINVAL; 456 return -EINVAL;
457 } 457 }
458#endif
459#ifndef CONFIG_JFFS2_FS_DATAFLASH
460 if (c->mtd->type == MTD_DATAFLASH) { 458 if (c->mtd->type == MTD_DATAFLASH) {
461 printk(KERN_ERR "jffs2: Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in.\n"); 459 printk(KERN_ERR "jffs2: Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in.\n");
462 return -EINVAL; 460 return -EINVAL;
diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
index a4864d05ea92..8c122838bf6d 100644
--- a/fs/jffs2/nodelist.h
+++ b/fs/jffs2/nodelist.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodelist.h,v 1.126 2004/11/19 15:06:29 dedekind Exp $ 10 * $Id: nodelist.h,v 1.127 2005/02/09 09:23:53 pavlov Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -462,7 +462,7 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c);
462/* erase.c */ 462/* erase.c */
463void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count); 463void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count);
464 464
465#ifdef CONFIG_JFFS2_FS_NAND 465#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
466/* wbuf.c */ 466/* wbuf.c */
467int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino); 467int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino);
468int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c); 468int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c);
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index af27b84007a1..8989cd685e46 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: os-linux.h,v 1.53 2005/02/09 09:17:41 pavlov Exp $ 10 * $Id: os-linux.h,v 1.54 2005/02/09 09:23:53 pavlov Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -97,16 +97,12 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
97#endif 97#endif
98} 98}
99 99
100#ifdef CONFIG_JFFS2_FS_DATAFLASH
101#define SECTOR_ADDR(x) ( ((unsigned long)(x) / (unsigned long)(c->sector_size)) * c->sector_size )
102#else
103#define SECTOR_ADDR(x) ( ((unsigned long)(x) & ~(c->sector_size-1)) )
104#endif
105 100
106#define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & MS_RDONLY) 101#define jffs2_is_readonly(c) (OFNI_BS_2SFFJ(c)->s_flags & MS_RDONLY)
107#define jffs2_is_writebuffered(c) (c->wbuf != NULL) 102#define jffs2_is_writebuffered(c) (c->wbuf != NULL)
108 103
109#if (!defined CONFIG_JFFS2_FS_NAND && !defined CONFIG_JFFS2_FS_NOR_ECC && !defined CONFIG_JFFS2_FS_DATAFLASH) 104#ifndef CONFIG_JFFS2_FS_WRITEBUFFER
105#define SECTOR_ADDR(x) ( ((unsigned long)(x) & ~(c->sector_size-1)) )
110#define jffs2_can_mark_obsolete(c) (1) 106#define jffs2_can_mark_obsolete(c) (1)
111#define jffs2_cleanmarker_oob(c) (0) 107#define jffs2_cleanmarker_oob(c) (0)
112#define jffs2_write_nand_cleanmarker(c,jeb) (-EIO) 108#define jffs2_write_nand_cleanmarker(c,jeb) (-EIO)
@@ -129,6 +125,7 @@ static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
129 125
130#else /* NAND and/or ECC'd NOR support present */ 126#else /* NAND and/or ECC'd NOR support present */
131 127
128#define SECTOR_ADDR(x) ( ((unsigned long)(x) / (unsigned long)(c->sector_size)) * c->sector_size )
132#define jffs2_can_mark_obsolete(c) ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & MTD_ECC)) || c->mtd->type == MTD_RAM) 129#define jffs2_can_mark_obsolete(c) ((c->mtd->type == MTD_NORFLASH && !(c->mtd->flags & MTD_ECC)) || c->mtd->type == MTD_RAM)
133#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH) 130#define jffs2_cleanmarker_oob(c) (c->mtd->type == MTD_NANDFLASH)
134 131
@@ -150,25 +147,16 @@ int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino);
150int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c); 147int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c);
151int jffs2_nand_flash_setup(struct jffs2_sb_info *c); 148int jffs2_nand_flash_setup(struct jffs2_sb_info *c);
152void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c); 149void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c);
153#ifdef CONFIG_JFFS2_FS_NOR_ECC 150
154#define jffs2_nor_ecc(c) (c->mtd->type == MTD_NORFLASH && (c->mtd->flags & MTD_ECC)) 151#define jffs2_nor_ecc(c) (c->mtd->type == MTD_NORFLASH && (c->mtd->flags & MTD_ECC))
155int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c); 152int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c);
156void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c); 153void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c);
157#else 154
158#define jffs2_nor_ecc(c) (0)
159#define jffs2_nor_ecc_flash_setup(c) (0)
160#define jffs2_nor_ecc_flash_cleanup(c) do {} while (0)
161#endif /* NOR ECC */
162#ifdef CONFIG_JFFS2_FS_DATAFLASH
163#define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH) 155#define jffs2_dataflash(c) (c->mtd->type == MTD_DATAFLASH)
164int jffs2_dataflash_setup(struct jffs2_sb_info *c); 156int jffs2_dataflash_setup(struct jffs2_sb_info *c);
165void jffs2_dataflash_cleanup(struct jffs2_sb_info *c); 157void jffs2_dataflash_cleanup(struct jffs2_sb_info *c);
166#else 158
167#define jffs2_dataflash(c) (0) 159#endif /* WRITEBUFFER */
168#define jffs2_dataflash_setup(c) (0)
169#define jffs2_dataflash_cleanup(c) do {} while (0)
170#endif /* DATAFLASH */
171#endif /* NAND */
172 160
173/* erase.c */ 161/* erase.c */
174static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c) 162static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c)
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index e8c43746c82e..bc6c99980026 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: scan.c,v 1.117 2005/02/09 09:17:41 pavlov Exp $ 10 * $Id: scan.c,v 1.118 2005/02/09 09:23:53 pavlov Exp $
11 * 11 *
12 */ 12 */
13#include <linux/kernel.h> 13#include <linux/kernel.h>
@@ -68,7 +68,7 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
68static inline int min_free(struct jffs2_sb_info *c) 68static inline int min_free(struct jffs2_sb_info *c)
69{ 69{
70 uint32_t min = 2 * sizeof(struct jffs2_raw_inode); 70 uint32_t min = 2 * sizeof(struct jffs2_raw_inode);
71#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC || defined CONFIG_JFFS2_FS_DATAFLASH 71#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
72 if (!jffs2_can_mark_obsolete(c) && min < c->wbuf_pagesize) 72 if (!jffs2_can_mark_obsolete(c) && min < c->wbuf_pagesize)
73 return c->wbuf_pagesize; 73 return c->wbuf_pagesize;
74#endif 74#endif
@@ -228,7 +228,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c)
228 c->dirty_size -= c->nextblock->dirty_size; 228 c->dirty_size -= c->nextblock->dirty_size;
229 c->nextblock->dirty_size = 0; 229 c->nextblock->dirty_size = 0;
230 } 230 }
231#if defined CONFIG_JFFS2_FS_NAND || defined CONFIG_JFFS2_FS_NOR_ECC || defined CONFIG_JFFS2_FS_DATAFLASH 231#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
232 if (!jffs2_can_mark_obsolete(c) && c->nextblock && (c->nextblock->free_size & (c->wbuf_pagesize-1))) { 232 if (!jffs2_can_mark_obsolete(c) && c->nextblock && (c->nextblock->free_size & (c->wbuf_pagesize-1))) {
233 /* If we're going to start writing into a block which already 233 /* If we're going to start writing into a block which already
234 contains data, and the end of the data isn't page-aligned, 234 contains data, and the end of the data isn't page-aligned,
@@ -294,7 +294,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
294 uint32_t hdr_crc, buf_ofs, buf_len; 294 uint32_t hdr_crc, buf_ofs, buf_len;
295 int err; 295 int err;
296 int noise = 0; 296 int noise = 0;
297#ifdef CONFIG_JFFS2_FS_NAND 297#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
298 int cleanmarkerfound = 0; 298 int cleanmarkerfound = 0;
299#endif 299#endif
300 300
@@ -303,7 +303,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
303 303
304 D1(printk(KERN_DEBUG "jffs2_scan_eraseblock(): Scanning block at 0x%x\n", ofs)); 304 D1(printk(KERN_DEBUG "jffs2_scan_eraseblock(): Scanning block at 0x%x\n", ofs));
305 305
306#ifdef CONFIG_JFFS2_FS_NAND 306#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
307 if (jffs2_cleanmarker_oob(c)) { 307 if (jffs2_cleanmarker_oob(c)) {
308 int ret = jffs2_check_nand_cleanmarker(c, jeb); 308 int ret = jffs2_check_nand_cleanmarker(c, jeb);
309 D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n",ret)); 309 D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n",ret));
@@ -338,7 +338,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo
338 ofs += 4; 338 ofs += 4;
339 339
340 if (ofs == EMPTY_SCAN_SIZE(c->sector_size)) { 340 if (ofs == EMPTY_SCAN_SIZE(c->sector_size)) {
341#ifdef CONFIG_JFFS2_FS_NAND 341#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
342 if (jffs2_cleanmarker_oob(c)) { 342 if (jffs2_cleanmarker_oob(c)) {
343 /* scan oob, take care of cleanmarker */ 343 /* scan oob, take care of cleanmarker */
344 int ret = jffs2_check_oob_empty(c, jeb, cleanmarkerfound); 344 int ret = jffs2_check_oob_empty(c, jeb, cleanmarkerfound);
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 6b2a441d2766..3bfc121a4674 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: super.c,v 1.104 2004/11/23 15:37:31 gleixner Exp $ 10 * $Id: super.c,v 1.105 2005/02/09 09:23:54 pavlov Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -309,7 +309,7 @@ static int __init init_jffs2_fs(void)
309 int ret; 309 int ret;
310 310
311 printk(KERN_INFO "JFFS2 version 2.2." 311 printk(KERN_INFO "JFFS2 version 2.2."
312#ifdef CONFIG_JFFS2_FS_NAND 312#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
313 " (NAND)" 313 " (NAND)"
314#endif 314#endif
315 " (C) 2001-2003 Red Hat, Inc.\n"); 315 " (C) 2001-2003 Red Hat, Inc.\n");
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index a35e007e5bf8..890258505a7f 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -9,7 +9,7 @@
9 * 9 *
10 * For licensing information, see the file 'LICENCE' in this directory. 10 * For licensing information, see the file 'LICENCE' in this directory.
11 * 11 *
12 * $Id: wbuf.c,v 1.88 2005/02/09 09:17:41 pavlov Exp $ 12 * $Id: wbuf.c,v 1.89 2005/02/09 09:23:54 pavlov Exp $
13 * 13 *
14 */ 14 */
15 15
@@ -604,7 +604,7 @@ int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c)
604 return ret; 604 return ret;
605} 605}
606 606
607#ifdef CONFIG_JFFS2_FS_DATAFLASH 607#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
608#define PAGE_DIV(x) ( ((unsigned long)(x) / (unsigned long)(c->wbuf_pagesize)) * (unsigned long)(c->wbuf_pagesize) ) 608#define PAGE_DIV(x) ( ((unsigned long)(x) / (unsigned long)(c->wbuf_pagesize)) * (unsigned long)(c->wbuf_pagesize) )
609#define PAGE_MOD(x) ( (unsigned long)(x) % (unsigned long)(c->wbuf_pagesize) ) 609#define PAGE_MOD(x) ( (unsigned long)(x) % (unsigned long)(c->wbuf_pagesize) )
610#else 610#else
@@ -1198,7 +1198,6 @@ void jffs2_nand_flash_cleanup(struct jffs2_sb_info *c)
1198 kfree(c->wbuf); 1198 kfree(c->wbuf);
1199} 1199}
1200 1200
1201#ifdef CONFIG_JFFS2_FS_DATAFLASH
1202int jffs2_dataflash_setup(struct jffs2_sb_info *c) { 1201int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
1203 c->cleanmarker_size = 0; /* No cleanmarkers needed */ 1202 c->cleanmarker_size = 0; /* No cleanmarkers needed */
1204 1203
@@ -1219,9 +1218,7 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
1219void jffs2_dataflash_cleanup(struct jffs2_sb_info *c) { 1218void jffs2_dataflash_cleanup(struct jffs2_sb_info *c) {
1220 kfree(c->wbuf); 1219 kfree(c->wbuf);
1221} 1220}
1222#endif
1223 1221
1224#ifdef CONFIG_JFFS2_FS_NOR_ECC
1225int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c) { 1222int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c) {
1226 /* Cleanmarker is actually larger on the flashes */ 1223 /* Cleanmarker is actually larger on the flashes */
1227 c->cleanmarker_size = 16; 1224 c->cleanmarker_size = 16;
@@ -1241,4 +1238,3 @@ int jffs2_nor_ecc_flash_setup(struct jffs2_sb_info *c) {
1241void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) { 1238void jffs2_nor_ecc_flash_cleanup(struct jffs2_sb_info *c) {
1242 kfree(c->wbuf); 1239 kfree(c->wbuf);
1243} 1240}
1244#endif