/* @ai: UBI attach info object @pnum: The PEB to be unmapped  */
static void unmap_peb(struct ubi_attach_info *ai, int pnum)
/* @ai: UBI attach info object @pnum: The PEB to be unmapped  */
static void unmap_peb(struct ubi_attach_info *ai, int pnum)
{
	struct ubi_ainf_volume *av;
	struct rb_node *node, *node2;
	struct ubi_ainf_peb *aeb;
	for (node = rb_first(&ai->volumes); node; node = rb_next(node)) {
		av = rb_entry(node, struct ubi_ainf_volume, rb);
		for (node2 = rb_first(&av->root); node2;
		     node2 = rb_next(node2)) {
			aeb = rb_entry(node2, struct ubi_ainf_peb, u.rb);
			if (aeb->pnum == pnum) {
				rb_erase(&aeb->u.rb, &av->root);
				av->leb_count--;
				kmem_cache_free(ai->aeb_slab_cache, aeb);
				return;
			}
		}
	}
}