All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 1/2] GFS2: Introduce GLF_EX_SHARING bit: local EX sharing
@ 2018-05-14 21:20 Andreas Gruenbacher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gruenbacher @ 2018-05-14 21:20 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On 8 May 2018 at 22:04, Bob Peterson <rpeterso@redhat.com> wrote:
> This patch is a first step in rgrp sharing. It allows for glocks
> locked in EX mode to be shared amongst processes on that node.
> Like a Shared glock, multiple processes may hold the lock in
> EX mode at the same time, provided they're all on the same
> node. All other nodes will see this as an EX lock.
> For now, there are no users of the new flag. A future patch
> will use it to improve performance with rgrp sharing.

The flag isn't called GLF_EX_SHARING anymore, so please fix the
subject. I don't like the flag name LM_FLAG_SHAREDEX very much. The
flag indicates that the node holds a glock exclusively and individual
processes on the node can share it, so how about LM_FLAG_NODEEX or
similar instead?

> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
>  fs/gfs2/glock.c | 23 +++++++++++++++++++----
>  fs/gfs2/glock.h |  4 ++++
>  2 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index 097bd3c0f270..a463de5fad2e 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -279,10 +279,20 @@ void gfs2_glock_put(struct gfs2_glock *gl)
>
>  static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holder *gh)
>  {
> -       const struct gfs2_holder *gh_head = list_entry(gl->gl_holders.next, const struct gfs2_holder, gh_list);
> -       if ((gh->gh_state == LM_ST_EXCLUSIVE ||
> -            gh_head->gh_state == LM_ST_EXCLUSIVE) && gh != gh_head)
> -               return 0;
> +       const struct gfs2_holder *gh_head = list_entry(gl->gl_holders.next,
> +                                                      const struct gfs2_holder,
> +                                                      gh_list);
> +
> +       if (gh != gh_head) {
> +               if (gh_head->gh_state == LM_ST_EXCLUSIVE &&
> +                   (gh_head->gh_flags & LM_FLAG_SHAREDEX) &&
> +                   gh->gh_state == LM_ST_EXCLUSIVE &&
> +                   (gh->gh_flags & LM_FLAG_SHAREDEX))
> +                       return 1;
> +               if ((gh->gh_state == LM_ST_EXCLUSIVE ||
> +                    gh_head->gh_state == LM_ST_EXCLUSIVE))
> +                       return 0;
> +       }
>         if (gl->gl_state == gh->gh_state)
>                 return 1;
>         if (gh->gh_flags & GL_EXACT)
> @@ -292,6 +302,9 @@ static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holde
>                         return 1;
>                 if (gh->gh_state == LM_ST_DEFERRED && gh_head->gh_state == LM_ST_DEFERRED)
>                         return 1;
> +               if (gh_head->gh_flags & LM_FLAG_SHAREDEX &&
> +                   gh->gh_flags & LM_FLAG_SHAREDEX)
> +                       return 1;
>         }
>         if (gl->gl_state != LM_ST_UNLOCKED && (gh->gh_flags & LM_FLAG_ANY))
>                 return 1;
> @@ -1680,6 +1693,8 @@ static const char *hflags2str(char *buf, u16 flags, unsigned long iflags)
>                 *p++ = 'A';
>         if (flags & LM_FLAG_PRIORITY)
>                 *p++ = 'p';
> +       if (flags & LM_FLAG_SHAREDEX)
> +               *p++ = 's';
>         if (flags & GL_ASYNC)
>                 *p++ = 'a';
>         if (flags & GL_EXACT)
> diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
> index 5e12220cc0c2..3ab7d7f8d986 100644
> --- a/fs/gfs2/glock.h
> +++ b/fs/gfs2/glock.h
> @@ -78,6 +78,9 @@ enum {
>   * request and directly join the other shared lock.  A shared lock request
>   * without the priority flag might be forced to wait until the deferred
>   * requested had acquired and released the lock.
> + *
> + * LM_FLAG_SHAREDEX
> + * The glock may be held in EXCLUSIVE mode, but it's still shared

That doesn't work to document what the flag does, sorry.

>   */
>
>  #define LM_FLAG_TRY            0x0001
> @@ -85,6 +88,7 @@ enum {
>  #define LM_FLAG_NOEXP          0x0004
>  #define LM_FLAG_ANY            0x0008
>  #define LM_FLAG_PRIORITY       0x0010
> +#define LM_FLAG_SHAREDEX       0x0020
>  #define GL_ASYNC               0x0040
>  #define GL_EXACT               0x0080
>  #define GL_SKIP                        0x0100
> --
> 2.14.3
>

Thanks,
Andreas



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

* [Cluster-devel] [PATCH 1/2] GFS2: Introduce GLF_EX_SHARING bit: local EX sharing
  2018-05-08 20:04 [Cluster-devel] [PATCH 0/2] Improve throughput through rgrp sharing (v2) Bob Peterson
@ 2018-05-08 20:04 ` Bob Peterson
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Peterson @ 2018-05-08 20:04 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This patch is a first step in rgrp sharing. It allows for glocks
locked in EX mode to be shared amongst processes on that node.
Like a Shared glock, multiple processes may hold the lock in
EX mode at the same time, provided they're all on the same
node. All other nodes will see this as an EX lock.
For now, there are no users of the new flag. A future patch
will use it to improve performance with rgrp sharing.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
 fs/gfs2/glock.c | 23 +++++++++++++++++++----
 fs/gfs2/glock.h |  4 ++++
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 097bd3c0f270..a463de5fad2e 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -279,10 +279,20 @@ void gfs2_glock_put(struct gfs2_glock *gl)
 
 static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holder *gh)
 {
-	const struct gfs2_holder *gh_head = list_entry(gl->gl_holders.next, const struct gfs2_holder, gh_list);
-	if ((gh->gh_state == LM_ST_EXCLUSIVE ||
-	     gh_head->gh_state == LM_ST_EXCLUSIVE) && gh != gh_head)
-		return 0;
+	const struct gfs2_holder *gh_head = list_entry(gl->gl_holders.next,
+						       const struct gfs2_holder,
+						       gh_list);
+
+	if (gh != gh_head) {
+		if (gh_head->gh_state == LM_ST_EXCLUSIVE &&
+		    (gh_head->gh_flags & LM_FLAG_SHAREDEX) &&
+		    gh->gh_state == LM_ST_EXCLUSIVE &&
+		    (gh->gh_flags & LM_FLAG_SHAREDEX))
+			return 1;
+		if ((gh->gh_state == LM_ST_EXCLUSIVE ||
+		     gh_head->gh_state == LM_ST_EXCLUSIVE))
+			return 0;
+	}
 	if (gl->gl_state == gh->gh_state)
 		return 1;
 	if (gh->gh_flags & GL_EXACT)
@@ -292,6 +302,9 @@ static inline int may_grant(const struct gfs2_glock *gl, const struct gfs2_holde
 			return 1;
 		if (gh->gh_state == LM_ST_DEFERRED && gh_head->gh_state == LM_ST_DEFERRED)
 			return 1;
+		if (gh_head->gh_flags & LM_FLAG_SHAREDEX &&
+		    gh->gh_flags & LM_FLAG_SHAREDEX)
+			return 1;
 	}
 	if (gl->gl_state != LM_ST_UNLOCKED && (gh->gh_flags & LM_FLAG_ANY))
 		return 1;
@@ -1680,6 +1693,8 @@ static const char *hflags2str(char *buf, u16 flags, unsigned long iflags)
 		*p++ = 'A';
 	if (flags & LM_FLAG_PRIORITY)
 		*p++ = 'p';
+	if (flags & LM_FLAG_SHAREDEX)
+		*p++ = 's';
 	if (flags & GL_ASYNC)
 		*p++ = 'a';
 	if (flags & GL_EXACT)
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 5e12220cc0c2..3ab7d7f8d986 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -78,6 +78,9 @@ enum {
  * request and directly join the other shared lock.  A shared lock request
  * without the priority flag might be forced to wait until the deferred
  * requested had acquired and released the lock.
+ *
+ * LM_FLAG_SHAREDEX
+ * The glock may be held in EXCLUSIVE mode, but it's still shared
  */
 
 #define LM_FLAG_TRY		0x0001
@@ -85,6 +88,7 @@ enum {
 #define LM_FLAG_NOEXP		0x0004
 #define LM_FLAG_ANY		0x0008
 #define LM_FLAG_PRIORITY	0x0010
+#define LM_FLAG_SHAREDEX	0x0020
 #define GL_ASYNC		0x0040
 #define GL_EXACT		0x0080
 #define GL_SKIP			0x0100
-- 
2.14.3



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

end of thread, other threads:[~2018-05-14 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-14 21:20 [Cluster-devel] [PATCH 1/2] GFS2: Introduce GLF_EX_SHARING bit: local EX sharing Andreas Gruenbacher
  -- strict thread matches above, loose matches on Subject: below --
2018-05-08 20:04 [Cluster-devel] [PATCH 0/2] Improve throughput through rgrp sharing (v2) Bob Peterson
2018-05-08 20:04 ` [Cluster-devel] [PATCH 1/2] GFS2: Introduce GLF_EX_SHARING bit: local EX sharing Bob Peterson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.