aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/erase.c
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2005-02-09 04:17:45 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 06:28:03 -0400
commit8f15fd55f9bf266139b10850947e19c4e3f4e9b7 (patch)
tree3df936efbffbbd6c20dd75f51780ac37458285ff /fs/jffs2/erase.c
parent3be36675d41a30ed3b192f92684f1417aa0f8bfe (diff)
[JFFS2] Add support for JFFS2-on-Dataflash devices.
For Dataflash, can_mark_obsolete = false and the NAND write buffering code (wbuf.c) is used. Since the DataFlash chip will automatically erase pages when writing, the cleanmarkers are not needed - so cleanmarker_oob = false and cleanmarker_size = 0 DataFlash page-sizes are not a power of two (they're multiples of 528 bytes). The SECTOR_ADDR macro (added in the previous core patch) is replaced with a (slower) div/mod version if CONFIG_JFFS2_FS_DATAFLASH is selected. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r--fs/jffs2/erase.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index ae858f878875..a3c6cc150497 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.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: erase.c,v 1.70 2005/02/09 09:09:01 pavlov Exp $ 10 * $Id: erase.c,v 1.71 2005/02/09 09:17:40 pavlov Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -310,7 +310,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
310 int ret; 310 int ret;
311 uint32_t bad_offset; 311 uint32_t bad_offset;
312 312
313 if (!jffs2_cleanmarker_oob(c)) { 313 if ((!jffs2_cleanmarker_oob(c)) && (c->cleanmarker_size > 0)) {
314 marker_ref = jffs2_alloc_raw_node_ref(); 314 marker_ref = jffs2_alloc_raw_node_ref();
315 if (!marker_ref) { 315 if (!marker_ref) {
316 printk(KERN_WARNING "Failed to allocate raw node ref for clean marker\n"); 316 printk(KERN_WARNING "Failed to allocate raw node ref for clean marker\n");
@@ -351,7 +351,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
351 bad_offset += i; 351 bad_offset += i;
352 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", datum, bad_offset); 352 printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", datum, bad_offset);
353 bad: 353 bad:
354 if (!jffs2_cleanmarker_oob(c)) 354 if ((!jffs2_cleanmarker_oob(c)) && (c->cleanmarker_size > 0))
355 jffs2_free_raw_node_ref(marker_ref); 355 jffs2_free_raw_node_ref(marker_ref);
356 kfree(ebuf); 356 kfree(ebuf);
357 bad2: 357 bad2:
@@ -387,6 +387,13 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
387 jeb->used_size = 0; 387 jeb->used_size = 0;
388 jeb->dirty_size = 0; 388 jeb->dirty_size = 0;
389 jeb->wasted_size = 0; 389 jeb->wasted_size = 0;
390 } else if (c->cleanmarker_size == 0) {
391 jeb->first_node = jeb->last_node = NULL;
392
393 jeb->free_size = c->sector_size;
394 jeb->used_size = 0;
395 jeb->dirty_size = 0;
396 jeb->wasted_size = 0;
390 } else { 397 } else {
391 struct kvec vecs[1]; 398 struct kvec vecs[1];
392 struct jffs2_unknown_node marker = { 399 struct jffs2_unknown_node marker = {