]> Pileus Git - ~andy/linux/blobdiff - fs/ubifs/log.c
fs/ubifs: use rbtree postorder iteration helper instead of opencoding
[~andy/linux] / fs / ubifs / log.c
index 36bd4efd0819e96ee299acd030f24fa7113e4fb2..a902c5919e423ca619fcf0508345909b51ec99f8 100644 (file)
@@ -574,27 +574,10 @@ static int done_already(struct rb_root *done_tree, int lnum)
  */
 static void destroy_done_tree(struct rb_root *done_tree)
 {
-       struct rb_node *this = done_tree->rb_node;
-       struct done_ref *dr;
+       struct done_ref *dr, *n;
 
-       while (this) {
-               if (this->rb_left) {
-                       this = this->rb_left;
-                       continue;
-               } else if (this->rb_right) {
-                       this = this->rb_right;
-                       continue;
-               }
-               dr = rb_entry(this, struct done_ref, rb);
-               this = rb_parent(this);
-               if (this) {
-                       if (this->rb_left == &dr->rb)
-                               this->rb_left = NULL;
-                       else
-                               this->rb_right = NULL;
-               }
+       rbtree_postorder_for_each_entry_safe(dr, n, done_tree, rb)
                kfree(dr);
-       }
 }
 
 /**