diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-05-24 04:04:17 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-05-24 04:04:17 -0400 |
commit | 99988f7bbd16b861590dda4631c4db6cb17b5091 (patch) | |
tree | 38865d44c905d7f84d7eeb70186482e1e399fe9c /fs/jffs2/nodemgmt.c | |
parent | 2f785402f39b96a077b6e62bf26164bfb8e0c980 (diff) |
[JFFS2] Introduce ref_next() macro for finding next physical node
Another part of the preparation for switching to an array...
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/nodemgmt.c')
-rw-r--r-- | fs/jffs2/nodemgmt.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c index 01bf2773fe4d..f4649c275fbe 100644 --- a/fs/jffs2/nodemgmt.c +++ b/fs/jffs2/nodemgmt.c | |||
@@ -458,6 +458,7 @@ static inline int on_list(struct list_head *obj, struct list_head *head) | |||
458 | void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref) | 458 | void 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; | ||
461 | int blocknr; | 462 | int blocknr; |
462 | struct jffs2_unknown_node n; | 463 | struct jffs2_unknown_node n; |
463 | int ret, addedsize; | 464 | int ret, addedsize; |
@@ -685,24 +686,23 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
685 | 686 | ||
686 | /* Merge with the next node in the physical list, if there is one | 687 | /* Merge with the next node in the physical list, if there is one |
687 | and if it's also obsolete and if it doesn't belong to any inode */ | 688 | and if it's also obsolete and if it doesn't belong to any inode */ |
688 | if (ref->next_phys && ref_obsolete(ref->next_phys) && | 689 | next_ref = ref_next(ref); |
689 | !ref->next_phys->next_in_ino) { | ||
690 | struct jffs2_raw_node_ref *n = ref->next_phys; | ||
691 | 690 | ||
691 | if (next_ref && ref_obsolete(next_ref) && !next_ref->next_in_ino) { | ||
692 | spin_lock(&c->erase_completion_lock); | 692 | spin_lock(&c->erase_completion_lock); |
693 | 693 | ||
694 | #ifdef TEST_TOTLEN | 694 | #ifdef TEST_TOTLEN |
695 | ref->__totlen += n->__totlen; | 695 | ref->__totlen += next_ref->__totlen; |
696 | #endif | 696 | #endif |
697 | ref->next_phys = n->next_phys; | 697 | ref->next_phys = ref_next(next_ref); |
698 | if (jeb->last_node == n) jeb->last_node = ref; | 698 | if (jeb->last_node == next_ref) jeb->last_node = ref; |
699 | if (jeb->gc_node == n) { | 699 | if (jeb->gc_node == next_ref) { |
700 | /* gc will be happy continuing gc on this node */ | 700 | /* gc will be happy continuing gc on this node */ |
701 | jeb->gc_node=ref; | 701 | jeb->gc_node=ref; |
702 | } | 702 | } |
703 | spin_unlock(&c->erase_completion_lock); | 703 | spin_unlock(&c->erase_completion_lock); |
704 | 704 | ||
705 | __jffs2_free_raw_node_ref(n); | 705 | __jffs2_free_raw_node_ref(next_ref); |
706 | } | 706 | } |
707 | 707 | ||
708 | /* Also merge with the previous node in the list, if there is one | 708 | /* Also merge with the previous node in the list, if there is one |
@@ -712,8 +712,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
712 | 712 | ||
713 | spin_lock(&c->erase_completion_lock); | 713 | spin_lock(&c->erase_completion_lock); |
714 | 714 | ||
715 | while (p->next_phys != ref) | 715 | while ((next_ref = ref_next(ref)) != ref) |
716 | p = p->next_phys; | 716 | p = next_ref; |
717 | 717 | ||
718 | if (ref_obsolete(p) && !ref->next_in_ino) { | 718 | if (ref_obsolete(p) && !ref->next_in_ino) { |
719 | #ifdef TEST_TOTLEN | 719 | #ifdef TEST_TOTLEN |
@@ -726,7 +726,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref | |||
726 | /* gc will be happy continuing gc on this node */ | 726 | /* gc will be happy continuing gc on this node */ |
727 | jeb->gc_node=p; | 727 | jeb->gc_node=p; |
728 | } | 728 | } |
729 | p->next_phys = ref->next_phys; | 729 | p->next_phys = ref_next(ref); |
730 | __jffs2_free_raw_node_ref(ref); | 730 | __jffs2_free_raw_node_ref(ref); |
731 | } | 731 | } |
732 | spin_unlock(&c->erase_completion_lock); | 732 | spin_unlock(&c->erase_completion_lock); |