/* This function searches bud LEB @lnum. Returns bud description object in case of success and NULL if there is no bud with this LEB number.  */
struct ubifs_bud* ubifs_search_bud(struct ubifs_info *c, int lnum)
/* This function searches bud LEB @lnum. Returns bud description object in case of success and NULL if there is no bud with this LEB number.  */
struct ubifs_bud* ubifs_search_bud(struct ubifs_info *c, int lnum)
{
	struct rb_node *p;
	struct ubifs_bud *bud;
	spin_lock(&c->buds_lock);
	p = c->buds.rb_node;
	while (p) {
		bud = rb_entry(p, struct ubifs_bud, rb);
		if (lnum < bud->lnum)
			p = p->rb_left;
		else if (lnum > bud->lnum)
			p = p->rb_right;
		else {
			spin_unlock(&c->buds_lock);
			return bud;
		}
	}
	spin_unlock(&c->buds_lock);
	return NULL;
}