@@ -141,23 +141,17 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node(
/* cached in the btrfs inode and can be accessed */
refcount_set(&node->refs, 2);
- ret = radix_tree_preload(GFP_NOFS);
- if (ret) {
- kmem_cache_free(delayed_node_cache, node);
- return ERR_PTR(ret);
- }
-
spin_lock(&root->inode_lock);
- ret = radix_tree_insert(&root->delayed_nodes_xarray, ino, node);
- if (ret == -EEXIST) {
+ ret = xa_insert(&root->delayed_nodes_xarray, ino, node, GFP_NOFS);
+ if (ret) {
spin_unlock(&root->inode_lock);
kmem_cache_free(delayed_node_cache, node);
- radix_tree_preload_end();
- goto again;
+ if (ret == -EBUSY)
+ goto again;
+ return ERR_PTR(ret);
}
btrfs_inode->delayed_node = node;
spin_unlock(&root->inode_lock);
- radix_tree_preload_end();
return node;
}
Signed-off-by: Gabriel Niebler <gniebler@suse.com> --- fs/btrfs/delayed-inode.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)