/* This function locks a logical eraseblock for writing. Returns zero in case of success and a negative error code in case of failure.  */
static int leb_write_lock(struct ubi_device *ubi, int vol_id, int lnum)
/* This function locks a logical eraseblock for writing. Returns zero in case of success and a negative error code in case of failure.  */
static int leb_write_lock(struct ubi_device *ubi, int vol_id, int lnum)
{
	struct ubi_ltree_entry *le;
	le = ltree_add_entry(ubi, vol_id, lnum);
	if (IS_ERR(le))
		return PTR_ERR(le);
	down_write(&le->mutex);
	return 0;
}