diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-26 20:19:05 (GMT) |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-26 20:19:05 (GMT) |
commit | 9bfeb691e75b21fdaa80ffae719083200b190381 (patch) | |
tree | 3c828820f1385249835f85e5073b4ffd10fcd09c /fs/jffs2/erase.c | |
parent | f75e5097ef298c5a0aa106faa211d1afdc92dc3d (diff) | |
download | linux-9bfeb691e75b21fdaa80ffae719083200b190381.tar.xz |
[JFFS2] Switch to using an array of jffs2_raw_node_refs instead of a list.
This allows us to drop another pointer from the struct jffs2_raw_node_ref,
shrinking it to 8 bytes on 32-bit machines (if the TEST_TOTLEN) paranoia
check is turned off, which will be committed soon).
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/erase.c')
-rw-r--r-- | fs/jffs2/erase.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index c8386b2..1862e8b 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c @@ -285,20 +285,25 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) { - struct jffs2_raw_node_ref *ref; + struct jffs2_raw_node_ref *block, *ref; D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset)); - while(jeb->first_node) { - ref = jeb->first_node; - jeb->first_node = ref->next_phys; - /* Remove from the inode-list */ - if (ref->next_in_ino) + block = ref = jeb->first_node; + + while (ref) { + if (ref->flash_offset == REF_LINK_NODE) { + ref = ref->next_in_ino; + jffs2_free_refblock(block); + block = ref; + continue; + } + if (ref->flash_offset != REF_EMPTY_NODE && ref->next_in_ino) jffs2_remove_node_refs_from_ino_list(c, ref, jeb); /* else it was a non-inode node or already removed, so don't bother */ - __jffs2_free_raw_node_ref(ref); + ref++; } - jeb->last_node = NULL; + jeb->first_node = jeb->last_node = NULL; } static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *bad_offset) |