aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/erase.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-20 14:45:26 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-20 14:45:26 -0400
commitf1f9671bd8f7d2ac6a918bad806ab5bdc0daaf4e (patch)
treef1fb5992fbd299375c911eb4c36d7fc8774f9208 /fs/jffs2/erase.c
parent0cfc7da3ff4b39a3aac261ab3f6b1329e2485653 (diff)
[JFFS2] Introduce jffs2_link_node_ref() function to reduce code duplication
The same sequence of code was repeated in many places, to add a new struct jffs2_raw_node_ref to an eraseblock and adjust the space accounting accordingly. Move it out-of-line. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r--fs/jffs2/erase.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index dad68fdffe9e..fecf5584f830 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -373,12 +373,8 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
373 goto filebad; 373 goto filebad;
374 } 374 }
375 375
376 jeb->first_node = jeb->last_node = NULL; 376 /* Everything else got zeroed before the erase */
377 jeb->free_size = c->sector_size; 377 jeb->free_size = c->sector_size;
378 jeb->used_size = 0;
379 jeb->dirty_size = 0;
380 jeb->wasted_size = 0;
381
382 } else { 378 } else {
383 379
384 struct kvec vecs[1]; 380 struct kvec vecs[1];
@@ -412,17 +408,13 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
412 goto filebad; 408 goto filebad;
413 } 409 }
414 410
411 /* Everything else got zeroed before the erase */
412 jeb->free_size = c->sector_size;
413
415 marker_ref->next_in_ino = NULL; 414 marker_ref->next_in_ino = NULL;
416 marker_ref->next_phys = NULL;
417 marker_ref->flash_offset = jeb->offset | REF_NORMAL; 415 marker_ref->flash_offset = jeb->offset | REF_NORMAL;
418 marker_ref->__totlen = c->cleanmarker_size;
419
420 jeb->first_node = jeb->last_node = marker_ref;
421 416
422 jeb->free_size = c->sector_size - c->cleanmarker_size; 417 jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size);
423 jeb->used_size = c->cleanmarker_size;
424 jeb->dirty_size = 0;
425 jeb->wasted_size = 0;
426 } 418 }
427 419
428 spin_lock(&c->erase_completion_lock); 420 spin_lock(&c->erase_completion_lock);