/* During start commit, the old_idx RB-tree is used to avoid overwriting index nodes that were in the index last commit but have since been deleted. This is necessary for recovery i.e. the old index must be kept intact until the new index is successfully written. The old-idx RB-tree is used for the in-the-gaps method of writing index nodes and is destroyed every commit.  */
void destroy_old_idx(struct ubifs_info *c)
/* During start commit, the old_idx RB-tree is used to avoid overwriting index nodes that were in the index last commit but have since been deleted. This is necessary for recovery i.e. the old index must be kept intact until the new index is successfully written. The old-idx RB-tree is used for the in-the-gaps method of writing index nodes and is destroyed every commit.  */
void destroy_old_idx(struct ubifs_info *c)
{
	struct ubifs_old_idx *old_idx, *n;
	rbtree_postorder_for_each_entry_safe(old_idx, n, &c->old_idx, rb)
		kfree(old_idx);
	c->old_idx = RB_ROOT;
}