/* This function is called on when the commit operation was finished. It moves log tail to new position and updates the master node so that it stores the new log tail LEB number. Returns zero in case of success and a negative error code in case of failure.  */
int ubifs_log_end_commit(struct ubifs_info *c, int ltail_lnum)
/* This function is called on when the commit operation was finished. It moves log tail to new position and updates the master node so that it stores the new log tail LEB number. Returns zero in case of success and a negative error code in case of failure.  */
int ubifs_log_end_commit(struct ubifs_info *c, int ltail_lnum)
{
	int err;
	mutex_lock(&c->log_mutex);
	dbg_log("old tail was LEB %d:0, new tail is LEB %d:0",
		c->ltail_lnum, ltail_lnum);
	c->ltail_lnum = ltail_lnum;
	c->min_log_bytes = c->leb_size;
	spin_lock(&c->buds_lock);
	c->bud_bytes -= c->cmt_bud_bytes;
	spin_unlock(&c->buds_lock);
	err = dbg_check_bud_bytes(c);
	if (err)
		goto out;
	err = ubifs_write_master(c);
out:
	mutex_unlock(&c->log_mutex);
	return err;
}