Commit 95e94d14 authored by Rashika's avatar Rashika Committed by Chris Mason

btrfs: Replace multiple atomic_inc() with atomic_add()

This patch replaces multiple atomic_inc() with atomic_add() in
delayed-inode.c to reduce source code and have few instructions
for compilation.
Reviewed-by: default avatarZach Brown <zab@redhat.com>
Signed-off-by: default avatarRashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 2e9f5954
...@@ -108,8 +108,8 @@ static struct btrfs_delayed_node *btrfs_get_delayed_node(struct inode *inode) ...@@ -108,8 +108,8 @@ static struct btrfs_delayed_node *btrfs_get_delayed_node(struct inode *inode)
return node; return node;
} }
btrfs_inode->delayed_node = node; btrfs_inode->delayed_node = node;
atomic_inc(&node->refs); /* can be accessed */ /* can be accessed and cached in the inode */
atomic_inc(&node->refs); /* cached in the inode */ atomic_add(2, &node->refs);
spin_unlock(&root->inode_lock); spin_unlock(&root->inode_lock);
return node; return node;
} }
...@@ -138,8 +138,8 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node( ...@@ -138,8 +138,8 @@ static struct btrfs_delayed_node *btrfs_get_or_create_delayed_node(
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
btrfs_init_delayed_node(node, root, ino); btrfs_init_delayed_node(node, root, ino);
atomic_inc(&node->refs); /* cached in the btrfs inode */ /* cached in the btrfs inode and can be accessed */
atomic_inc(&node->refs); /* can be accessed */ atomic_add(2, &node->refs);
ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM); ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment