All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2 PATCH] GFS2: Fix gfs2_replay_incr_blk for multiple journal sizes
       [not found] <448332604.16892514.1469125158528.JavaMail.zimbra@redhat.com>
@ 2016-07-21 18:20 ` Bob Peterson
  2016-07-22 13:57   ` Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2016-07-21 18:20 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Before this patch, if you used gfs2_jadd to add new journals of a
size smaller than the existing journals, replaying those new journals
would withdraw. That's because function gfs2_replay_incr_blk was
using the number of journal blocks (jd_block) from the superblock's
journal pointer. In other words, "My journal's max size" rather than
"the journal we're replaying's size." This patch changes the function
to use the size of the pertinent journal rather than always using the
journal we happen to be using.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index d5369a1..8e3ba20 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -535,9 +535,9 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
 	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
 		return 0;
 
-	gfs2_replay_incr_blk(sdp, &start);
+	gfs2_replay_incr_blk(jd, &start);
 
-	for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
+	for (; blks; gfs2_replay_incr_blk(jd, &start), blks--) {
 		blkno = be64_to_cpu(*ptr++);
 
 		jd->jd_found_blocks++;
@@ -693,7 +693,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
 
 	offset = sizeof(struct gfs2_log_descriptor);
 
-	for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
+	for (; blks; gfs2_replay_incr_blk(jd, &start), blks--) {
 		error = gfs2_replay_read_block(jd, start, &bh);
 		if (error)
 			return error;
@@ -762,7 +762,6 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
 				    __be64 *ptr, int pass)
 {
 	struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
-	struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
 	struct gfs2_glock *gl = ip->i_gl;
 	unsigned int blks = be32_to_cpu(ld->ld_data1);
 	struct buffer_head *bh_log, *bh_ip;
@@ -773,8 +772,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
 	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_JDATA)
 		return 0;
 
-	gfs2_replay_incr_blk(sdp, &start);
-	for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
+	gfs2_replay_incr_blk(jd, &start);
+	for (; blks; gfs2_replay_incr_blk(jd, &start), blks--) {
 		blkno = be64_to_cpu(*ptr++);
 		esc = be64_to_cpu(*ptr++);
 
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 1b64577..113b609 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -338,7 +338,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
 			struct gfs2_log_header_host lh;
 			error = get_log_header(jd, start, &lh);
 			if (!error) {
-				gfs2_replay_incr_blk(sdp, &start);
+				gfs2_replay_incr_blk(jd, &start);
 				brelse(bh);
 				continue;
 			}
@@ -360,7 +360,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
 		}
 
 		while (length--)
-			gfs2_replay_incr_blk(sdp, &start);
+			gfs2_replay_incr_blk(jd, &start);
 
 		brelse(bh);
 	}
@@ -390,7 +390,7 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *hea
 	struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
 
 	lblock = head->lh_blkno;
-	gfs2_replay_incr_blk(sdp, &lblock);
+	gfs2_replay_incr_blk(jd, &lblock);
 	bh_map.b_size = 1 << ip->i_inode.i_blkbits;
 	error = gfs2_block_map(&ip->i_inode, lblock, &bh_map, 0);
 	if (error)
diff --git a/fs/gfs2/recovery.h b/fs/gfs2/recovery.h
index 6142836..11fdfab 100644
--- a/fs/gfs2/recovery.h
+++ b/fs/gfs2/recovery.h
@@ -14,9 +14,9 @@
 
 extern struct workqueue_struct *gfs_recovery_wq;
 
-static inline void gfs2_replay_incr_blk(struct gfs2_sbd *sdp, unsigned int *blk)
+static inline void gfs2_replay_incr_blk(struct gfs2_jdesc *jd, unsigned int *blk)
 {
-	if (++*blk == sdp->sd_jdesc->jd_blocks)
+	if (++*blk == jd->jd_blocks)
 	        *blk = 0;
 }
 



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

* [Cluster-devel] [GFS2 PATCH] GFS2: Fix gfs2_replay_incr_blk for multiple journal sizes
  2016-07-21 18:20 ` [Cluster-devel] [GFS2 PATCH] GFS2: Fix gfs2_replay_incr_blk for multiple journal sizes Bob Peterson
@ 2016-07-22 13:57   ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2016-07-22 13:57 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.


On 21/07/16 19:20, Bob Peterson wrote:
> Hi,
>
> Before this patch, if you used gfs2_jadd to add new journals of a
> size smaller than the existing journals, replaying those new journals
> would withdraw. That's because function gfs2_replay_incr_blk was
> using the number of journal blocks (jd_block) from the superblock's
> journal pointer. In other words, "My journal's max size" rather than
> "the journal we're replaying's size." This patch changes the function
> to use the size of the pertinent journal rather than always using the
> journal we happen to be using.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
> index d5369a1..8e3ba20 100644
> --- a/fs/gfs2/lops.c
> +++ b/fs/gfs2/lops.c
> @@ -535,9 +535,9 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
>   	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
>   		return 0;
>   
> -	gfs2_replay_incr_blk(sdp, &start);
> +	gfs2_replay_incr_blk(jd, &start);
>   
> -	for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
> +	for (; blks; gfs2_replay_incr_blk(jd, &start), blks--) {
>   		blkno = be64_to_cpu(*ptr++);
>   
>   		jd->jd_found_blocks++;
> @@ -693,7 +693,7 @@ static int revoke_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
>   
>   	offset = sizeof(struct gfs2_log_descriptor);
>   
> -	for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
> +	for (; blks; gfs2_replay_incr_blk(jd, &start), blks--) {
>   		error = gfs2_replay_read_block(jd, start, &bh);
>   		if (error)
>   			return error;
> @@ -762,7 +762,6 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
>   				    __be64 *ptr, int pass)
>   {
>   	struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
> -	struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
>   	struct gfs2_glock *gl = ip->i_gl;
>   	unsigned int blks = be32_to_cpu(ld->ld_data1);
>   	struct buffer_head *bh_log, *bh_ip;
> @@ -773,8 +772,8 @@ static int databuf_lo_scan_elements(struct gfs2_jdesc *jd, unsigned int start,
>   	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_JDATA)
>   		return 0;
>   
> -	gfs2_replay_incr_blk(sdp, &start);
> -	for (; blks; gfs2_replay_incr_blk(sdp, &start), blks--) {
> +	gfs2_replay_incr_blk(jd, &start);
> +	for (; blks; gfs2_replay_incr_blk(jd, &start), blks--) {
>   		blkno = be64_to_cpu(*ptr++);
>   		esc = be64_to_cpu(*ptr++);
>   
> diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
> index 1b64577..113b609 100644
> --- a/fs/gfs2/recovery.c
> +++ b/fs/gfs2/recovery.c
> @@ -338,7 +338,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
>   			struct gfs2_log_header_host lh;
>   			error = get_log_header(jd, start, &lh);
>   			if (!error) {
> -				gfs2_replay_incr_blk(sdp, &start);
> +				gfs2_replay_incr_blk(jd, &start);
>   				brelse(bh);
>   				continue;
>   			}
> @@ -360,7 +360,7 @@ static int foreach_descriptor(struct gfs2_jdesc *jd, unsigned int start,
>   		}
>   
>   		while (length--)
> -			gfs2_replay_incr_blk(sdp, &start);
> +			gfs2_replay_incr_blk(jd, &start);
>   
>   		brelse(bh);
>   	}
> @@ -390,7 +390,7 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header_host *hea
>   	struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 };
>   
>   	lblock = head->lh_blkno;
> -	gfs2_replay_incr_blk(sdp, &lblock);
> +	gfs2_replay_incr_blk(jd, &lblock);
>   	bh_map.b_size = 1 << ip->i_inode.i_blkbits;
>   	error = gfs2_block_map(&ip->i_inode, lblock, &bh_map, 0);
>   	if (error)
> diff --git a/fs/gfs2/recovery.h b/fs/gfs2/recovery.h
> index 6142836..11fdfab 100644
> --- a/fs/gfs2/recovery.h
> +++ b/fs/gfs2/recovery.h
> @@ -14,9 +14,9 @@
>   
>   extern struct workqueue_struct *gfs_recovery_wq;
>   
> -static inline void gfs2_replay_incr_blk(struct gfs2_sbd *sdp, unsigned int *blk)
> +static inline void gfs2_replay_incr_blk(struct gfs2_jdesc *jd, unsigned int *blk)
>   {
> -	if (++*blk == sdp->sd_jdesc->jd_blocks)
> +	if (++*blk == jd->jd_blocks)
>   	        *blk = 0;
>   }
>   
>



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

end of thread, other threads:[~2016-07-22 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <448332604.16892514.1469125158528.JavaMail.zimbra@redhat.com>
2016-07-21 18:20 ` [Cluster-devel] [GFS2 PATCH] GFS2: Fix gfs2_replay_incr_blk for multiple journal sizes Bob Peterson
2016-07-22 13:57   ` Steven Whitehouse

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.