/* This function loads and dirties an index node so that it can be garbage collected. The @key argument has to be the key of the first child. This function relies on the fact that 0:0 is never a valid LEB number and offset for a main-area node. Returns %0 on success and a negative error code on failure.  */
int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, int lnum, int offs)
/* This function loads and dirties an index node so that it can be garbage collected. The @key argument has to be the key of the first child. This function relies on the fact that 0:0 is never a valid LEB number and offset for a main-area node. Returns %0 on success and a negative error code on failure.  */
int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level, int lnum, int offs)
{
	struct ubifs_znode *znode;
	int err = 0;
	mutex_lock(&c->tnc_mutex);
	znode = lookup_znode(c, key, level, lnum, offs);
	if (!znode)
		goto out_unlock;
	if (IS_ERR(znode)) {
		err = PTR_ERR(znode);
		goto out_unlock;
	}
	znode = dirty_cow_bottom_up(c, znode);
	if (IS_ERR(znode)) {
		err = PTR_ERR(znode);
		goto out_unlock;
	}
out_unlock:
	mutex_unlock(&c->tnc_mutex);
	return err;
}