All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] GFS2: reserve more blocks for transactions
@ 2010-09-21 14:58 Benjamin Marzinski
  2010-09-21 15:36 ` Steven Whitehouse
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Marzinski @ 2010-09-21 14:58 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Some of the functions in GFS2 were not reserving space in the transaction for
the resource group header and the resource groups bitblocks that get added
when you do allocation. GFS2 now makes sure to reserve space for the
resource group header and either all the bitblocks in the resource group, or
one for each block that it may allocate, whichever is smaller.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 fs/gfs2/aops.c  |    3 +++
 fs/gfs2/bmap.c  |    2 +-
 fs/gfs2/file.c  |    5 ++++-
 fs/gfs2/quota.c |    2 ++
 4 files changed, 10 insertions(+), 2 deletions(-)

Index: gfs2-2.6-nmw/fs/gfs2/aops.c
===================================================================
--- gfs2-2.6-nmw.orig/fs/gfs2/aops.c
+++ gfs2-2.6-nmw/fs/gfs2/aops.c
@@ -663,6 +663,9 @@ static int gfs2_write_begin(struct file 
 		rblocks += RES_STATFS + RES_QUOTA;
 	if (&ip->i_inode == sdp->sd_rindex)
 		rblocks += 2 * RES_STATFS;
+	if (alloc_required)
+		rblocks += (al->al_requested < al->al_rgd->rd_length)?
+			   al->al_requested + 1 : al->al_rgd->rd_length;
 
 	error = gfs2_trans_begin(sdp, rblocks,
 				 PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);
Index: gfs2-2.6-nmw/fs/gfs2/bmap.c
===================================================================
--- gfs2-2.6-nmw.orig/fs/gfs2/bmap.c
+++ gfs2-2.6-nmw/fs/gfs2/bmap.c
@@ -1151,7 +1151,7 @@ static int do_grow(struct inode *inode, 
 			goto do_grow_qunlock;
 	}
 
-	error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
+	error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT, 0);
 	if (error)
 		goto do_grow_release;
 
Index: gfs2-2.6-nmw/fs/gfs2/file.c
===================================================================
--- gfs2-2.6-nmw.orig/fs/gfs2/file.c
+++ gfs2-2.6-nmw/fs/gfs2/file.c
@@ -382,8 +382,11 @@ static int gfs2_page_mkwrite(struct vm_a
 	rblocks = RES_DINODE + ind_blocks;
 	if (gfs2_is_jdata(ip))
 		rblocks += data_blocks ? data_blocks : 1;
-	if (ind_blocks || data_blocks)
+	if (ind_blocks || data_blocks) {
 		rblocks += RES_STATFS + RES_QUOTA;
+		rblocks += (al->al_requested < al->al_rgd->rd_length)?
+			   al->al_requested + 1 : al->al_rgd->rd_length;
+	}
 	ret = gfs2_trans_begin(sdp, rblocks, 0);
 	if (ret)
 		goto out_trans_fail;
Index: gfs2-2.6-nmw/fs/gfs2/quota.c
===================================================================
--- gfs2-2.6-nmw.orig/fs/gfs2/quota.c
+++ gfs2-2.6-nmw/fs/gfs2/quota.c
@@ -1586,6 +1586,8 @@ static int gfs2_set_dqblk(struct super_b
 		error = gfs2_inplace_reserve(ip);
 		if (error)
 			goto out_alloc;
+		blocks += (al->al_requested < al->al_rgd->rd_length)?
+			  al->al_requested + 1 : al->al_rgd->rd_length;
 	}
 
 	error = gfs2_trans_begin(sdp, blocks + RES_DINODE + 1, 0);



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

* [Cluster-devel] [PATCH] GFS2: reserve more blocks for transactions
  2010-09-21 14:58 [Cluster-devel] [PATCH] GFS2: reserve more blocks for transactions Benjamin Marzinski
@ 2010-09-21 15:36 ` Steven Whitehouse
  2010-09-21 15:40   ` Benjamin Marzinski
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Whitehouse @ 2010-09-21 15:36 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On Tue, 2010-09-21 at 09:58 -0500, Benjamin Marzinski wrote:
> Some of the functions in GFS2 were not reserving space in the transaction for
> the resource group header and the resource groups bitblocks that get added
> when you do allocation. GFS2 now makes sure to reserve space for the
> resource group header and either all the bitblocks in the resource group, or
> one for each block that it may allocate, whichever is smaller.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  fs/gfs2/aops.c  |    3 +++
>  fs/gfs2/bmap.c  |    2 +-
>  fs/gfs2/file.c  |    5 ++++-
>  fs/gfs2/quota.c |    2 ++
>  4 files changed, 10 insertions(+), 2 deletions(-)
> 
> Index: gfs2-2.6-nmw/fs/gfs2/aops.c
> ===================================================================
> --- gfs2-2.6-nmw.orig/fs/gfs2/aops.c
> +++ gfs2-2.6-nmw/fs/gfs2/aops.c
> @@ -663,6 +663,9 @@ static int gfs2_write_begin(struct file 
>  		rblocks += RES_STATFS + RES_QUOTA;
>  	if (&ip->i_inode == sdp->sd_rindex)
>  		rblocks += 2 * RES_STATFS;
> +	if (alloc_required)
> +		rblocks += (al->al_requested < al->al_rgd->rd_length)?
> +			   al->al_requested + 1 : al->al_rgd->rd_length;
Since this bit seems to occur multiple times, perhaps you could turn it
into an inline function with a suitably explanatory name? That should
make it a bit easier to understand what it is doing,

Steve.

>  
>  	error = gfs2_trans_begin(sdp, rblocks,
>  				 PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);
> Index: gfs2-2.6-nmw/fs/gfs2/bmap.c
> ===================================================================
> --- gfs2-2.6-nmw.orig/fs/gfs2/bmap.c
> +++ gfs2-2.6-nmw/fs/gfs2/bmap.c
> @@ -1151,7 +1151,7 @@ static int do_grow(struct inode *inode, 
>  			goto do_grow_qunlock;
>  	}
>  
> -	error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
> +	error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT, 0);
>  	if (error)
>  		goto do_grow_release;
>  
> Index: gfs2-2.6-nmw/fs/gfs2/file.c
> ===================================================================
> --- gfs2-2.6-nmw.orig/fs/gfs2/file.c
> +++ gfs2-2.6-nmw/fs/gfs2/file.c
> @@ -382,8 +382,11 @@ static int gfs2_page_mkwrite(struct vm_a
>  	rblocks = RES_DINODE + ind_blocks;
>  	if (gfs2_is_jdata(ip))
>  		rblocks += data_blocks ? data_blocks : 1;
> -	if (ind_blocks || data_blocks)
> +	if (ind_blocks || data_blocks) {
>  		rblocks += RES_STATFS + RES_QUOTA;
> +		rblocks += (al->al_requested < al->al_rgd->rd_length)?
> +			   al->al_requested + 1 : al->al_rgd->rd_length;
> +	}
>  	ret = gfs2_trans_begin(sdp, rblocks, 0);
>  	if (ret)
>  		goto out_trans_fail;
> Index: gfs2-2.6-nmw/fs/gfs2/quota.c
> ===================================================================
> --- gfs2-2.6-nmw.orig/fs/gfs2/quota.c
> +++ gfs2-2.6-nmw/fs/gfs2/quota.c
> @@ -1586,6 +1586,8 @@ static int gfs2_set_dqblk(struct super_b
>  		error = gfs2_inplace_reserve(ip);
>  		if (error)
>  			goto out_alloc;
> +		blocks += (al->al_requested < al->al_rgd->rd_length)?
> +			  al->al_requested + 1 : al->al_rgd->rd_length;
>  	}
>  
>  	error = gfs2_trans_begin(sdp, blocks + RES_DINODE + 1, 0);
> 




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

* [Cluster-devel] [PATCH] GFS2: reserve more blocks for transactions
  2010-09-21 15:36 ` Steven Whitehouse
@ 2010-09-21 15:40   ` Benjamin Marzinski
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Marzinski @ 2010-09-21 15:40 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Tue, Sep 21, 2010 at 04:36:19PM +0100, Steven Whitehouse wrote:
> Hi,
> 
> On Tue, 2010-09-21 at 09:58 -0500, Benjamin Marzinski wrote:
> > Some of the functions in GFS2 were not reserving space in the transaction for
> > the resource group header and the resource groups bitblocks that get added
> > when you do allocation. GFS2 now makes sure to reserve space for the
> > resource group header and either all the bitblocks in the resource group, or
> > one for each block that it may allocate, whichever is smaller.
> > 
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > ---
> >  fs/gfs2/aops.c  |    3 +++
> >  fs/gfs2/bmap.c  |    2 +-
> >  fs/gfs2/file.c  |    5 ++++-
> >  fs/gfs2/quota.c |    2 ++
> >  4 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > Index: gfs2-2.6-nmw/fs/gfs2/aops.c
> > ===================================================================
> > --- gfs2-2.6-nmw.orig/fs/gfs2/aops.c
> > +++ gfs2-2.6-nmw/fs/gfs2/aops.c
> > @@ -663,6 +663,9 @@ static int gfs2_write_begin(struct file 
> >  		rblocks += RES_STATFS + RES_QUOTA;
> >  	if (&ip->i_inode == sdp->sd_rindex)
> >  		rblocks += 2 * RES_STATFS;
> > +	if (alloc_required)
> > +		rblocks += (al->al_requested < al->al_rgd->rd_length)?
> > +			   al->al_requested + 1 : al->al_rgd->rd_length;
> Since this bit seems to occur multiple times, perhaps you could turn it
> into an inline function with a suitably explanatory name? That should
> make it a bit easier to understand what it is doing,

Sure

-Ben

> 
> Steve.
> 
> >  
> >  	error = gfs2_trans_begin(sdp, rblocks,
> >  				 PAGE_CACHE_SIZE/sdp->sd_sb.sb_bsize);
> > Index: gfs2-2.6-nmw/fs/gfs2/bmap.c
> > ===================================================================
> > --- gfs2-2.6-nmw.orig/fs/gfs2/bmap.c
> > +++ gfs2-2.6-nmw/fs/gfs2/bmap.c
> > @@ -1151,7 +1151,7 @@ static int do_grow(struct inode *inode, 
> >  			goto do_grow_qunlock;
> >  	}
> >  
> > -	error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
> > +	error = gfs2_trans_begin(sdp, RES_DINODE + RES_STATFS + RES_RG_BIT, 0);
> >  	if (error)
> >  		goto do_grow_release;
> >  
> > Index: gfs2-2.6-nmw/fs/gfs2/file.c
> > ===================================================================
> > --- gfs2-2.6-nmw.orig/fs/gfs2/file.c
> > +++ gfs2-2.6-nmw/fs/gfs2/file.c
> > @@ -382,8 +382,11 @@ static int gfs2_page_mkwrite(struct vm_a
> >  	rblocks = RES_DINODE + ind_blocks;
> >  	if (gfs2_is_jdata(ip))
> >  		rblocks += data_blocks ? data_blocks : 1;
> > -	if (ind_blocks || data_blocks)
> > +	if (ind_blocks || data_blocks) {
> >  		rblocks += RES_STATFS + RES_QUOTA;
> > +		rblocks += (al->al_requested < al->al_rgd->rd_length)?
> > +			   al->al_requested + 1 : al->al_rgd->rd_length;
> > +	}
> >  	ret = gfs2_trans_begin(sdp, rblocks, 0);
> >  	if (ret)
> >  		goto out_trans_fail;
> > Index: gfs2-2.6-nmw/fs/gfs2/quota.c
> > ===================================================================
> > --- gfs2-2.6-nmw.orig/fs/gfs2/quota.c
> > +++ gfs2-2.6-nmw/fs/gfs2/quota.c
> > @@ -1586,6 +1586,8 @@ static int gfs2_set_dqblk(struct super_b
> >  		error = gfs2_inplace_reserve(ip);
> >  		if (error)
> >  			goto out_alloc;
> > +		blocks += (al->al_requested < al->al_rgd->rd_length)?
> > +			  al->al_requested + 1 : al->al_rgd->rd_length;
> >  	}
> >  
> >  	error = gfs2_trans_begin(sdp, blocks + RES_DINODE + 1, 0);
> > 
> 



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

end of thread, other threads:[~2010-09-21 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-21 14:58 [Cluster-devel] [PATCH] GFS2: reserve more blocks for transactions Benjamin Marzinski
2010-09-21 15:36 ` Steven Whitehouse
2010-09-21 15:40   ` Benjamin Marzinski

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.