linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] btrfs: Replace multiple atomic_inc() with atomic_add()
       [not found] <20131030212314.GA25069@gmail.com>
@ 2013-10-30 21:42 ` Rashika Kheria
  2013-11-02 16:59   ` [OPW kernel] " Josh Triplett
  0 siblings, 1 reply; 2+ messages in thread
From: Rashika Kheria @ 2013-10-30 21:42 UTC (permalink / raw)
  To: opw-kernel, linux-btrfs

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: Zach Brown <zab@redhat.com>
Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---

This revision fixes the following issues of the previous revision-
Space in comment

 fs/btrfs/delayed-inode.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index cbd9523..504a9b5 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -108,8 +108,8 @@ static struct btrfs_delayed_node *btrfs_get_delayed_node(struct inode *inode)
 			return node;
 		}
 		btrfs_inode->delayed_node = node;
-		atomic_inc(&node->refs);	/* can be accessed */
-		atomic_inc(&node->refs);	/* cached in the inode */
+		/* can be accessed and cached in the inode */
+		atomic_add(2, &node->refs);
 		spin_unlock(&root->inode_lock);
 		return node;
 	}
@@ -138,8 +138,8 @@ again:
 		return ERR_PTR(-ENOMEM);
 	btrfs_init_delayed_node(node, root, ino);
 
-	atomic_inc(&node->refs);	/* cached in the btrfs inode */
-	atomic_inc(&node->refs);	/* can be accessed */
+	/* cached in the btrfs inode and can be accessed */
+	atomic_add(2, &node->refs);
 
 	ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM);
 	if (ret) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OPW kernel] [PATCH v2] btrfs: Replace multiple atomic_inc() with atomic_add()
  2013-10-30 21:42 ` [PATCH v2] btrfs: Replace multiple atomic_inc() with atomic_add() Rashika Kheria
@ 2013-11-02 16:59   ` Josh Triplett
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2013-11-02 16:59 UTC (permalink / raw)
  To: Rashika Kheria; +Cc: opw-kernel, linux-btrfs

On Thu, Oct 31, 2013 at 03:12:42AM +0530, Rashika Kheria wrote:
> 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: Zach Brown <zab@redhat.com>
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> 
> This revision fixes the following issues of the previous revision-
> Space in comment
> 
>  fs/btrfs/delayed-inode.c |    8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
> index cbd9523..504a9b5 100644
> --- a/fs/btrfs/delayed-inode.c
> +++ b/fs/btrfs/delayed-inode.c
> @@ -108,8 +108,8 @@ static struct btrfs_delayed_node *btrfs_get_delayed_node(struct inode *inode)
>  			return node;
>  		}
>  		btrfs_inode->delayed_node = node;
> -		atomic_inc(&node->refs);	/* can be accessed */
> -		atomic_inc(&node->refs);	/* cached in the inode */
> +		/* can be accessed and cached in the inode */
> +		atomic_add(2, &node->refs);
>  		spin_unlock(&root->inode_lock);
>  		return node;
>  	}
> @@ -138,8 +138,8 @@ again:
>  		return ERR_PTR(-ENOMEM);
>  	btrfs_init_delayed_node(node, root, ino);
>  
> -	atomic_inc(&node->refs);	/* cached in the btrfs inode */
> -	atomic_inc(&node->refs);	/* can be accessed */
> +	/* cached in the btrfs inode and can be accessed */
> +	atomic_add(2, &node->refs);
>  
>  	ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM);
>  	if (ret) {
> -- 
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-02 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20131030212314.GA25069@gmail.com>
2013-10-30 21:42 ` [PATCH v2] btrfs: Replace multiple atomic_inc() with atomic_add() Rashika Kheria
2013-11-02 16:59   ` [OPW kernel] " Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).