/* This function updates mtime and ctime of the inode if it is not equivalent to current time. Returns zero in case of success and a negative error code in case of failure.  */
static int update_mctime(struct ubifs_info *c, struct inode *inode)
/* This function updates mtime and ctime of the inode if it is not equivalent to current time. Returns zero in case of success and a negative error code in case of failure.  */
static int update_mctime(struct ubifs_info *c, struct inode *inode)
{
	struct timespec now = ubifs_current_time(inode);
	struct ubifs_inode *ui = ubifs_inode(inode);
	if (mctime_update_needed(inode, &now)) {
		int err, release;
		struct ubifs_budget_req req = { .dirtied_ino = 1,
				.dirtied_ino_d = ALIGN(ui->data_len, 8) };
		err = ubifs_budget_space(c, &req);
		if (err)
			return err;
		mutex_lock(&ui->ui_mutex);
		inode->i_mtime = inode->i_ctime = ubifs_current_time(inode);
		release = ui->dirty;
		mark_inode_dirty_sync(inode);
		mutex_unlock(&ui->ui_mutex);
		if (release)
			ubifs_release_budget(c, &req);
	}
	return 0;
}