diff options
Diffstat (limited to 'fs/ubifs/tnc.c')
| -rw-r--r-- | fs/ubifs/tnc.c | 27 | 
1 files changed, 6 insertions, 21 deletions
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 349f31a30f4..8a40cf9c02d 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c @@ -178,27 +178,11 @@ static int ins_clr_old_idx_znode(struct ubifs_info *c,   */  void destroy_old_idx(struct ubifs_info *c)  { -	struct rb_node *this = c->old_idx.rb_node; -	struct ubifs_old_idx *old_idx; +	struct ubifs_old_idx *old_idx, *n; -	while (this) { -		if (this->rb_left) { -			this = this->rb_left; -			continue; -		} else if (this->rb_right) { -			this = this->rb_right; -			continue; -		} -		old_idx = rb_entry(this, struct ubifs_old_idx, rb); -		this = rb_parent(this); -		if (this) { -			if (this->rb_left == &old_idx->rb) -				this->rb_left = NULL; -			else -				this->rb_right = NULL; -		} +	rbtree_postorder_for_each_entry_safe(old_idx, n, &c->old_idx, rb)  		kfree(old_idx); -	} +  	c->old_idx = RB_ROOT;  } @@ -2875,10 +2859,11 @@ void ubifs_tnc_close(struct ubifs_info *c)  {  	tnc_destroy_cnext(c);  	if (c->zroot.znode) { -		long n; +		long n, freed; -		ubifs_destroy_tnc_subtree(c->zroot.znode);  		n = atomic_long_read(&c->clean_zn_cnt); +		freed = ubifs_destroy_tnc_subtree(c->zroot.znode); +		ubifs_assert(freed == n);  		atomic_long_sub(n, &ubifs_clean_zn_cnt);  	}  	kfree(c->gap_lebs);  | 
