aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/log.c
diff options
context:
space:
mode:
authorCody P Schafer <cody@linux.vnet.ibm.com>2014-01-23 18:56:08 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-23 19:37:03 -0500
commitbb25e49ff8ab0ef0b3c073c09d55cf10ef8a2aa0 (patch)
tree0eb5d1ca02d4e9caccd9716e35d5baa448eb73c8 /fs/ubifs/log.c
parentb182837ac111e87f8e82cbcb0046449d9412187f (diff)
fs/ubifs: use rbtree postorder iteration helper instead of opencoding
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com> Cc: Michel Lespinasse <walken@google.com> Cc: Jan Kara <jack@suse.cz> Cc: Artem Bityutskiy <dedekind1@gmail.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ubifs/log.c')
-rw-r--r--fs/ubifs/log.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c
index 36bd4efd0819..a902c5919e42 100644
--- a/fs/ubifs/log.c
+++ b/fs/ubifs/log.c
@@ -574,27 +574,10 @@ static int done_already(struct rb_root *done_tree, int lnum)
574 */ 574 */
575static void destroy_done_tree(struct rb_root *done_tree) 575static void destroy_done_tree(struct rb_root *done_tree)
576{ 576{
577 struct rb_node *this = done_tree->rb_node; 577 struct done_ref *dr, *n;
578 struct done_ref *dr;
579 578
580 while (this) { 579 rbtree_postorder_for_each_entry_safe(dr, n, done_tree, rb)
581 if (this->rb_left) {
582 this = this->rb_left;
583 continue;
584 } else if (this->rb_right) {
585 this = this->rb_right;
586 continue;
587 }
588 dr = rb_entry(this, struct done_ref, rb);
589 this = rb_parent(this);
590 if (this) {
591 if (this->rb_left == &dr->rb)
592 this->rb_left = NULL;
593 else
594 this->rb_right = NULL;
595 }
596 kfree(dr); 580 kfree(dr);
597 }
598} 581}
599 582
600/** 583/**