aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/nodemgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/nodemgmt.c')
-rw-r--r--fs/jffs2/nodemgmt.c51
1 files changed, 1 insertions, 50 deletions
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index 73a06d01db48..71d1630609a5 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -458,14 +458,13 @@ static inline int on_list(struct list_head *obj, struct list_head *head)
458void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref) 458void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref)
459{ 459{
460 struct jffs2_eraseblock *jeb; 460 struct jffs2_eraseblock *jeb;
461 struct jffs2_raw_node_ref *next_ref;
462 int blocknr; 461 int blocknr;
463 struct jffs2_unknown_node n; 462 struct jffs2_unknown_node n;
464 int ret, addedsize; 463 int ret, addedsize;
465 size_t retlen; 464 size_t retlen;
466 uint32_t freed_len; 465 uint32_t freed_len;
467 466
468 if(!ref) { 467 if(unlikely(!ref)) {
469 printk(KERN_NOTICE "EEEEEK. jffs2_mark_node_obsolete called with NULL node\n"); 468 printk(KERN_NOTICE "EEEEEK. jffs2_mark_node_obsolete called with NULL node\n");
470 return; 469 return;
471 } 470 }
@@ -683,54 +682,6 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
683 spin_unlock(&c->erase_completion_lock); 682 spin_unlock(&c->erase_completion_lock);
684 } 683 }
685 684
686
687 /* Merge with the next node in the physical list, if there is one
688 and if it's also obsolete and if it doesn't belong to any inode */
689 next_ref = ref_next(ref);
690
691 if (next_ref && ref_obsolete(next_ref) && !next_ref->next_in_ino) {
692 spin_lock(&c->erase_completion_lock);
693
694#ifdef TEST_TOTLEN
695 ref->__totlen += next_ref->__totlen;
696#endif
697 ref->next_phys = ref_next(next_ref);
698 if (jeb->last_node == next_ref) jeb->last_node = ref;
699 if (jeb->gc_node == next_ref) {
700 /* gc will be happy continuing gc on this node */
701 jeb->gc_node=ref;
702 }
703 spin_unlock(&c->erase_completion_lock);
704
705 __jffs2_free_raw_node_ref(next_ref);
706 }
707
708 /* Also merge with the previous node in the list, if there is one
709 and that one is obsolete */
710 if (ref != jeb->first_node ) {
711 struct jffs2_raw_node_ref *p = jeb->first_node;
712
713 spin_lock(&c->erase_completion_lock);
714
715 while ((next_ref = ref_next(ref)) != ref)
716 p = next_ref;
717
718 if (ref_obsolete(p) && !ref->next_in_ino) {
719#ifdef TEST_TOTLEN
720 p->__totlen += ref->__totlen;
721#endif
722 if (jeb->last_node == ref) {
723 jeb->last_node = p;
724 }
725 if (jeb->gc_node == ref) {
726 /* gc will be happy continuing gc on this node */
727 jeb->gc_node=p;
728 }
729 p->next_phys = ref_next(ref);
730 __jffs2_free_raw_node_ref(ref);
731 }
732 spin_unlock(&c->erase_completion_lock);
733 }
734 out_erase_sem: 685 out_erase_sem:
735 up(&c->erase_free_sem); 686 up(&c->erase_free_sem);
736} 687}