aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/erase.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r--fs/jffs2/erase.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 4616fed75730..f939f908b948 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -296,7 +296,7 @@ void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *
296 jffs2_remove_node_refs_from_ino_list(c, ref, jeb); 296 jffs2_remove_node_refs_from_ino_list(c, ref, jeb);
297 /* else it was a non-inode node or already removed, so don't bother */ 297 /* else it was a non-inode node or already removed, so don't bother */
298 298
299 jffs2_free_raw_node_ref(ref); 299 __jffs2_free_raw_node_ref(ref);
300 } 300 }
301 jeb->last_node = NULL; 301 jeb->last_node = NULL;
302} 302}
@@ -351,7 +351,6 @@ fail:
351 351
352static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) 352static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb)
353{ 353{
354 struct jffs2_raw_node_ref *marker_ref = NULL;
355 size_t retlen; 354 size_t retlen;
356 int ret; 355 int ret;
357 uint32_t bad_offset; 356 uint32_t bad_offset;
@@ -384,11 +383,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
384 .totlen = cpu_to_je32(c->cleanmarker_size) 383 .totlen = cpu_to_je32(c->cleanmarker_size)
385 }; 384 };
386 385
387 marker_ref = jffs2_alloc_raw_node_ref(); 386 jffs2_prealloc_raw_node_refs(c, 1);
388 if (!marker_ref) {
389 printk(KERN_WARNING "Failed to allocate raw node ref for clean marker. Refiling\n");
390 goto refile;
391 }
392 387
393 marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4)); 388 marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4));
394 389
@@ -404,16 +399,13 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
404 printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n", 399 printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n",
405 jeb->offset, sizeof(marker), retlen); 400 jeb->offset, sizeof(marker), retlen);
406 401
407 jffs2_free_raw_node_ref(marker_ref);
408 goto filebad; 402 goto filebad;
409 } 403 }
410 404
411 /* Everything else got zeroed before the erase */ 405 /* Everything else got zeroed before the erase */
412 jeb->free_size = c->sector_size; 406 jeb->free_size = c->sector_size;
413 407 /* FIXME Special case for cleanmarker in empty block */
414 marker_ref->flash_offset = jeb->offset | REF_NORMAL; 408 jffs2_link_node_ref(c, jeb, jeb->offset | REF_NORMAL, c->cleanmarker_size, NULL);
415
416 jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size, NULL);
417 } 409 }
418 410
419 spin_lock(&c->erase_completion_lock); 411 spin_lock(&c->erase_completion_lock);