/* We have done the truncate/delete so we can go ahead and remove the orphan item for this particular inode.  */
int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode)
/* We have done the truncate/delete so we can go ahead and remove the orphan item for this particular inode.  */
int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode)
{
	struct btrfs_root *root = BTRFS_I(inode)->root;
	int ret = 0;
	spin_lock(&root->list_lock);
	if (list_empty(&BTRFS_I(inode)->i_orphan)) {
		spin_unlock(&root->list_lock);
		return 0;
	}
	list_del_init(&BTRFS_I(inode)->i_orphan);
	if (!trans) {
		spin_unlock(&root->list_lock);
		return 0;
	}
	spin_unlock(&root->list_lock);
	ret = btrfs_del_orphan_item(trans, root, inode->i_ino);
	return ret;
}