diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 19:45:26 +0100 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-20 19:45:26 +0100 |
commit | f1f9671bd8f7d2ac6a918bad806ab5bdc0daaf4e (patch) | |
tree | f1fb5992fbd299375c911eb4c36d7fc8774f9208 /fs/jffs2/erase.c | |
parent | 0cfc7da3ff4b39a3aac261ab3f6b1329e2485653 (diff) | |
download | linux-f1f9671bd8f7d2ac6a918bad806ab5bdc0daaf4e.tar.gz linux-f1f9671bd8f7d2ac6a918bad806ab5bdc0daaf4e.tar.bz2 linux-f1f9671bd8f7d2ac6a918bad806ab5bdc0daaf4e.zip |
[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.c | 18 |
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 goto filebad; } - jeb->first_node = jeb->last_node = NULL; + /* Everything else got zeroed before the erase */ jeb->free_size = c->sector_size; - jeb->used_size = 0; - jeb->dirty_size = 0; - jeb->wasted_size = 0; - } else { struct kvec vecs[1]; @@ -412,17 +408,13 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb goto filebad; } + /* Everything else got zeroed before the erase */ + jeb->free_size = c->sector_size; + marker_ref->next_in_ino = NULL; - marker_ref->next_phys = NULL; marker_ref->flash_offset = jeb->offset | REF_NORMAL; - marker_ref->__totlen = c->cleanmarker_size; - - jeb->first_node = jeb->last_node = marker_ref; - jeb->free_size = c->sector_size - c->cleanmarker_size; - jeb->used_size = c->cleanmarker_size; - jeb->dirty_size = 0; - jeb->wasted_size = 0; + jffs2_link_node_ref(c, jeb, marker_ref, c->cleanmarker_size); } spin_lock(&c->erase_completion_lock); |