/* find_anchor_wl_entry - find wear-leveling entry to used as anchor PEB. @root: the RB-tree where to look for  */
static struct ubi_wl_entry* find_anchor_wl_entry(struct rb_root *root)
/* find_anchor_wl_entry - find wear-leveling entry to used as anchor PEB. @root: the RB-tree where to look for  */
static struct ubi_wl_entry* find_anchor_wl_entry(struct rb_root *root)
{
	struct rb_node *p;
	struct ubi_wl_entry *e, *victim = NULL;
	int max_ec = UBI_MAX_ERASECOUNTER;
	ubi_rb_for_each_entry(p, e, root, u.rb) {
		if (e->pnum < UBI_FM_MAX_START && e->ec < max_ec) {
			victim = e;
			max_ec = e->ec;
		}
	}
	return victim;
}