cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2 Patch] bz 450641 - fix gfs2 block allocation
@ 2008-06-17 22:06 Benjamin Marzinski
  2008-06-24 10:34 ` Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Marzinski @ 2008-06-17 22:06 UTC (permalink / raw)
  To: cluster-devel.redhat.com

This patch fixes bz 450641.

This patch changes the computation for zero_metapath_length(). When you
are
extending the metadata tree, The indirect blocks that point to the new
data
block must either diverge from the existing tree either at the inode, or
at the
first indirect block. They can diverge at the first indirect block
because the
inode has room for 483 pointers while the indirect blocks have room for
509
pointers, so when the tree is grown, there is some free space in the
first
indirect block. What zero_metapath_length now computes is the height
where the
first indirect block for the new data block is located.  It can either
be 1 (if
the indirect block diverges from the inode) or 2 (if it diverges from
the first
indirect block).

The previous computation for this was incorrect.

-Ben

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 bmap.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

-------------- next part --------------
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
@@ -249,12 +249,9 @@ static void find_metapath(const struct g
 static inline unsigned int zero_metapath_length(const struct metapath *mp,
 						unsigned height)
 {
-	unsigned int i;
-	for (i = 0; i < height - 1; i++) {
-		if (mp->mp_list[i] != 0)
-			return i;
-	}
-	return height;
+	if (mp->mp_list[0] == 0)
+		return 2;
+	return 1;
 }
 
 /**

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

* [Cluster-devel] [GFS2 Patch] bz 450641 - fix gfs2 block allocation
  2008-06-17 22:06 [Cluster-devel] [GFS2 Patch] bz 450641 - fix gfs2 block allocation Benjamin Marzinski
@ 2008-06-24 10:34 ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2008-06-24 10:34 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On Tue, 2008-06-17 at 17:06 -0500, Benjamin Marzinski wrote:
> This patch fixes bz 450641.
> 
> This patch changes the computation for zero_metapath_length(). When you
> are
> extending the metadata tree, The indirect blocks that point to the new
> data
> block must either diverge from the existing tree either at the inode, or
> at the
> first indirect block. They can diverge at the first indirect block
> because the
> inode has room for 483 pointers while the indirect blocks have room for
> 509
> pointers, so when the tree is grown, there is some free space in the
> first
> indirect block. What zero_metapath_length now computes is the height
> where the
> first indirect block for the new data block is located.  It can either
> be 1 (if
> the indirect block diverges from the inode) or 2 (if it diverges from
> the first
> indirect block).
> 
> The previous computation for this was incorrect.
> 
> -Ben
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  bmap.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> plain text document attachment (gfs2_alloc.patch)
> 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
> @@ -249,12 +249,9 @@ static void find_metapath(const struct g
>  static inline unsigned int zero_metapath_length(const struct metapath *mp,
>  						unsigned height)
>  {
> -	unsigned int i;
> -	for (i = 0; i < height - 1; i++) {
> -		if (mp->mp_list[i] != 0)
> -			return i;
> -	}
> -	return height;
> +	if (mp->mp_list[0] == 0)
> +		return 2;
> +	return 1;
>  }
>  
>  /**

The patch looks good, but could you also remove the "height" argument to
the function since that it no longer required,

Steve.




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

end of thread, other threads:[~2008-06-24 10:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17 22:06 [Cluster-devel] [GFS2 Patch] bz 450641 - fix gfs2 block allocation Benjamin Marzinski
2008-06-24 10:34 ` Steven Whitehouse

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