diff options
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 c8386b256831..1862e8bc101d 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, | |||
285 | 285 | ||
286 | void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) | 286 | void jffs2_free_jeb_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) |
287 | { | 287 | { |
288 | struct jffs2_raw_node_ref *ref; | 288 | struct jffs2_raw_node_ref *block, *ref; |
289 | D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset)); | 289 | D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset)); |
290 | while(jeb->first_node) { | ||
291 | ref = jeb->first_node; | ||
292 | jeb->first_node = ref->next_phys; | ||
293 | 290 | ||
294 | /* Remove from the inode-list */ | 291 | block = ref = jeb->first_node; |
295 | if (ref->next_in_ino) | 292 | |
293 | while (ref) { | ||
294 | if (ref->flash_offset == REF_LINK_NODE) { | ||
295 | ref = ref->next_in_ino; | ||
296 | jffs2_free_refblock(block); | ||
297 | block = ref; | ||
298 | continue; | ||
299 | } | ||
300 | if (ref->flash_offset != REF_EMPTY_NODE && ref->next_in_ino) | ||
296 | jffs2_remove_node_refs_from_ino_list(c, ref, jeb); | 301 | 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 */ | 302 | /* else it was a non-inode node or already removed, so don't bother */ |
298 | 303 | ||
299 | __jffs2_free_raw_node_ref(ref); | 304 | ref++; |
300 | } | 305 | } |
301 | jeb->last_node = NULL; | 306 | jeb->first_node = jeb->last_node = NULL; |
302 | } | 307 | } |
303 | 308 | ||
304 | static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *bad_offset) | 309 | static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *bad_offset) |