Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570004 > unrolled thread

[PATCH 14/14] xfs: use atomic_dec_not_zero()

Started byFabian Frederick <fabf@skynet.be>
First post2017-01-30 19:50 +0100
Last post2017-01-31 06:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 14/14] xfs: use atomic_dec_not_zero() Fabian Frederick <fabf@skynet.be> - 2017-01-30 19:50 +0100
    Re: [PATCH 14/14] xfs: use atomic_dec_not_zero() "Darrick J. Wong" <darrick.wong@oracle.com> - 2017-01-31 01:40 +0100
      Re: [PATCH 14/14] xfs: use atomic_dec_not_zero() Fabian Frederick <fabf@skynet.be> - 2017-01-31 06:20 +0100

#1570004 — [PATCH 14/14] xfs: use atomic_dec_not_zero()

FromFabian Frederick <fabf@skynet.be>
Date2017-01-30 19:50 +0100
Subject[PATCH 14/14] xfs: use atomic_dec_not_zero()
Message-ID<t5pbz-7p2-11@gated-at.bofh.it>
instead of atomic_add_unless(value, -1, 0)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/xfs/xfs_buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index ac3b4db..51b2167 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1684,7 +1684,7 @@ xfs_buftarg_isolate(
 	 * zero. If the value is already zero, we need to reclaim the
 	 * buffer, otherwise it gets another trip through the LRU.
 	 */
-	if (!atomic_add_unless(&bp->b_lru_ref, -1, 0)) {
+	if (!atomic_dec_not_zero(&bp->b_lru_ref)) {
 		spin_unlock(&bp->b_lock);
 		return LRU_ROTATE;
 	}
-- 
2.9.3

[toc] | [next] | [standalone]


#1570208

From"Darrick J. Wong" <darrick.wong@oracle.com>
Date2017-01-31 01:40 +0100
Message-ID<t5uEh-2i4-1@gated-at.bofh.it>
In reply to#1570004
On Mon, Jan 30, 2017 at 07:48:44PM +0100, Fabian Frederick wrote:
> instead of atomic_add_unless(value, -1, 0)
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
>  fs/xfs/xfs_buf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> index ac3b4db..51b2167 100644
> --- a/fs/xfs/xfs_buf.c
> +++ b/fs/xfs/xfs_buf.c
> @@ -1684,7 +1684,7 @@ xfs_buftarg_isolate(
>  	 * zero. If the value is already zero, we need to reclaim the
>  	 * buffer, otherwise it gets another trip through the LRU.
>  	 */
> -	if (!atomic_add_unless(&bp->b_lru_ref, -1, 0)) {
> +	if (!atomic_dec_not_zero(&bp->b_lru_ref)) {

Hard to tell if this is correct, since there's no atomic_dec_not_zero
defined in any of my kernel trees' include/ headers and I haven't seen a
patch adding such a symbol appear on this list.  Did you hoist the
lib/fault-inject.c definition or something?

--D

>  		spin_unlock(&bp->b_lock);
>  		return LRU_ROTATE;
>  	}
> -- 
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1570320

FromFabian Frederick <fabf@skynet.be>
Date2017-01-31 06:20 +0100
Message-ID<t5z1f-53O-11@gated-at.bofh.it>
In reply to#1570208

> On 31 January 2017 at 01:30 "Darrick J. Wong" <darrick.wong@oracle.com> wrote:
>
>
> On Mon, Jan 30, 2017 at 07:48:44PM +0100, Fabian Frederick wrote:
> > instead of atomic_add_unless(value, -1, 0)
> >
> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> > ---
> >  fs/xfs/xfs_buf.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index ac3b4db..51b2167 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -1684,7 +1684,7 @@ xfs_buftarg_isolate(
> >      * zero. If the value is already zero, we need to reclaim the
> >      * buffer, otherwise it gets another trip through the LRU.
> >      */
> > -   if (!atomic_add_unless(&bp->b_lru_ref, -1, 0)) {
> > +   if (!atomic_dec_not_zero(&bp->b_lru_ref)) {
>
> Hard to tell if this is correct, since there's no atomic_dec_not_zero
> defined in any of my kernel trees' include/ headers and I haven't seen a
> patch adding such a symbol appear on this list.  Did you hoist the
> lib/fault-inject.c definition or something?
>
> --D
Hi Darrick,

    Exactly. See patch 1 from
https://marc.info/?l=linux-kernel&m=148580166032209&w=2
at https://marc.info/?l=linux-kernel&m=148580166032208&w=2

Regards,
Fabian
>
> >             spin_unlock(&bp->b_lock);
> >             return LRU_ROTATE;
> >     }
> > --
> > 2.9.3
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web