fs/ubifs: use rbtree postorder iteration helper instead of opencoding
[deliverable/linux.git] / fs / ubifs / recovery.c
index 065096e36ed9733a14f96090decb3131c0e0d184..c14adb2f420cb09c48fef049bf6d246b8d22cd28 100644 (file)
@@ -1335,29 +1335,14 @@ static void remove_ino(struct ubifs_info *c, ino_t inum)
  */
 void ubifs_destroy_size_tree(struct ubifs_info *c)
 {
-       struct rb_node *this = c->size_tree.rb_node;
-       struct size_entry *e;
+       struct size_entry *e, *n;
 
-       while (this) {
-               if (this->rb_left) {
-                       this = this->rb_left;
-                       continue;
-               } else if (this->rb_right) {
-                       this = this->rb_right;
-                       continue;
-               }
-               e = rb_entry(this, struct size_entry, rb);
+       rbtree_postorder_for_each_entry_safe(e, n, &c->size_tree, rb) {
                if (e->inode)
                        iput(e->inode);
-               this = rb_parent(this);
-               if (this) {
-                       if (this->rb_left == &e->rb)
-                               this->rb_left = NULL;
-                       else
-                               this->rb_right = NULL;
-               }
                kfree(e);
        }
+
        c->size_tree = RB_ROOT;
 }
 
This page took 0.035045 seconds and 5 git commands to generate.