Cluster-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] gfs2: Fix recovery slot bumping
@ 2019-08-26 16:14 Andreas Gruenbacher
  2019-08-26 19:58 ` Bob Peterson
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Gruenbacher @ 2019-08-26 16:14 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Get rid of the assumption that the number of slots can at most increase by
RECOVER_SIZE_INC (16) in set_recover_size.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/lock_dlm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 4361804646d8..2bc7a334aa0a 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -1035,12 +1035,12 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots,
 	}
 
 	old_size = ls->ls_recover_size;
-
-	if (old_size >= max_jid + 1)
+	new_size = old_size;
+	while (new_size < max_jid + 1)
+		new_size += RECOVER_SIZE_INC;
+	if (old_size == new_size)
 		return 0;
 
-	new_size = old_size + RECOVER_SIZE_INC;
-
 	submit = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS);
 	result = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS);
 	if (!submit || !result) {
-- 
2.20.1



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

* [Cluster-devel] [PATCH] gfs2: Fix recovery slot bumping
  2019-08-26 16:14 [Cluster-devel] [PATCH] gfs2: Fix recovery slot bumping Andreas Gruenbacher
@ 2019-08-26 19:58 ` Bob Peterson
  0 siblings, 0 replies; 2+ messages in thread
From: Bob Peterson @ 2019-08-26 19:58 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- Original Message -----
> Get rid of the assumption that the number of slots can at most increase by
> RECOVER_SIZE_INC (16) in set_recover_size.
> 
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> ---
>  fs/gfs2/lock_dlm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
> index 4361804646d8..2bc7a334aa0a 100644
> --- a/fs/gfs2/lock_dlm.c
> +++ b/fs/gfs2/lock_dlm.c
> @@ -1035,12 +1035,12 @@ static int set_recover_size(struct gfs2_sbd *sdp,
> struct dlm_slot *slots,
>  	}
>  
>  	old_size = ls->ls_recover_size;
> -
> -	if (old_size >= max_jid + 1)
> +	new_size = old_size;
> +	while (new_size < max_jid + 1)
> +		new_size += RECOVER_SIZE_INC;
> +	if (old_size == new_size)
>  		return 0;
>  
> -	new_size = old_size + RECOVER_SIZE_INC;
> -
>  	submit = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS);
>  	result = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS);
>  	if (!submit || !result) {
> --
> 2.20.1

Yes, that works, although I think it's more clear to say:
+	if (new_size == old_size)
than:
+	if (old_size == new_size)
IOW, it just sounds better. But whatever. It works either way.

Bob



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

end of thread, other threads:[~2019-08-26 19:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-26 16:14 [Cluster-devel] [PATCH] gfs2: Fix recovery slot bumping Andreas Gruenbacher
2019-08-26 19:58 ` Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox