linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to get lockref patch merged?
@ 2018-04-03 11:13 Andreas Gruenbacher
  2018-04-03 17:20 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Gruenbacher @ 2018-04-03 11:13 UTC (permalink / raw)
  To: Andrew Morton, Greg Kroah-Hartman, Herbert Xu; +Cc: Bob Peterson, LKML

Hello,

what's the best way to get the following lockref patch merged? The
maintainers file doesn't list a maintainer. Should we go straight to
Linus? Does one of you want to take it?

We have a gfs2 patch that depends on it.

Thanks,
Andreas

---------- Forwarded message ----------
From: Andreas Gruenbacher <agruenba@redhat.com>
Date: 29 March 2018 at 14:06
Subject: [PATCH v2 1/2] lockref: Add lockref_put_not_zero
To: cluster-devel@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, NeilBrown
<neilb@suse.com>, Thomas Graf <tgraf@suug.ch>, Herbert Xu
<herbert@gondor.apana.org.au>, Tom Herbert <tom@quantonium.net>,
Andreas Gruenbacher <agruenba@redhat.com>


Put a lockref unless the lockref is dead or its count would become zero.
This is the same as lockref_put_or_lock except that the lock is never
left held.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 include/linux/lockref.h |  1 +
 lib/lockref.c           | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/include/linux/lockref.h b/include/linux/lockref.h
index 2eac32095113..99f17cc8e163 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -37,6 +37,7 @@ struct lockref {
 extern void lockref_get(struct lockref *);
 extern int lockref_put_return(struct lockref *);
 extern int lockref_get_not_zero(struct lockref *);
+extern int lockref_put_not_zero(struct lockref *);
 extern int lockref_get_or_lock(struct lockref *);
 extern int lockref_put_or_lock(struct lockref *);

diff --git a/lib/lockref.c b/lib/lockref.c
index 47169ed7e964..3d468b53d4c9 100644
--- a/lib/lockref.c
+++ b/lib/lockref.c
@@ -80,6 +80,34 @@ int lockref_get_not_zero(struct lockref *lockref)
 }
 EXPORT_SYMBOL(lockref_get_not_zero);

+/**
+ * lockref_put_not_zero - Decrements count unless count <= 1 before decrement
+ * @lockref: pointer to lockref structure
+ * Return: 1 if count updated successfully or 0 if count would become zero
+ */
+int lockref_put_not_zero(struct lockref *lockref)
+{
+       int retval;
+
+       CMPXCHG_LOOP(
+               new.count--;
+               if (old.count <= 1)
+                       return 0;
+       ,
+               return 1;
+       );
+
+       spin_lock(&lockref->lock);
+       retval = 0;
+       if (lockref->count > 1) {
+               lockref->count--;
+               retval = 1;
+       }
+       spin_unlock(&lockref->lock);
+       return retval;
+}
+EXPORT_SYMBOL(lockref_put_not_zero);
+
 /**
  * lockref_get_or_lock - Increments count unless the count is 0 or dead
  * @lockref: pointer to lockref structure
--
2.14.3

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

* Re: How to get lockref patch merged?
  2018-04-03 11:13 How to get lockref patch merged? Andreas Gruenbacher
@ 2018-04-03 17:20 ` Greg Kroah-Hartman
  2018-04-03 18:18   ` Andreas Gruenbacher
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2018-04-03 17:20 UTC (permalink / raw)
  To: Andreas Gruenbacher; +Cc: Andrew Morton, Herbert Xu, Bob Peterson, LKML

On Tue, Apr 03, 2018 at 01:13:00PM +0200, Andreas Gruenbacher wrote:
> Hello,
> 
> what's the best way to get the following lockref patch merged? The
> maintainers file doesn't list a maintainer. Should we go straight to
> Linus? Does one of you want to take it?

Andrew normally takes lib/ patches, but:

> We have a gfs2 patch that depends on it.

Then just include it in your patch series for gfs2 through the normal
path you use for that.

thanks,

greg k-h

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

* Re: How to get lockref patch merged?
  2018-04-03 17:20 ` Greg Kroah-Hartman
@ 2018-04-03 18:18   ` Andreas Gruenbacher
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2018-04-03 18:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Andrew Morton, Herbert Xu, Bob Peterson, LKML

On 3 April 2018 at 19:20, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
> On Tue, Apr 03, 2018 at 01:13:00PM +0200, Andreas Gruenbacher wrote:
>> Hello,
>>
>> what's the best way to get the following lockref patch merged? The
>> maintainers file doesn't list a maintainer. Should we go straight to
>> Linus? Does one of you want to take it?
>
> Andrew normally takes lib/ patches, but:
>
>> We have a gfs2 patch that depends on it.
>
> Then just include it in your patch series for gfs2 through the normal
> path you use for that.

Ok, will do. Thanks for your help.

Andreas

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

end of thread, other threads:[~2018-04-03 18:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 11:13 How to get lockref patch merged? Andreas Gruenbacher
2018-04-03 17:20 ` Greg Kroah-Hartman
2018-04-03 18:18   ` Andreas Gruenbacher

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).