* [Cluster-devel] [PATCH] gfs2_grow: Fix gfs2_grow when only one RG is present
@ 2011-08-11 19:37 Carlos Maiolino
2011-08-12 8:53 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: Carlos Maiolino @ 2011-08-11 19:37 UTC (permalink / raw)
To: cluster-devel.redhat.com
If there is only one RG in the filesystem
gfs2_grow will make a subtraction using a
null pointer to check the RG size returning
a invalide RG size value.
This patch avoid this substraction if there is
only one RG in the filesystem.
---
gfs2/mkfs/main_grow.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index 0eca396..d7a81a3 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -133,7 +133,11 @@ static void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *orgsize)
r1 = osi_list_entry(head->next->next, struct rgrp_list, list);
r2 = osi_list_entry(head->next->next->next, struct rgrp_list, list);
- *orgsize = r2->ri.ri_addr - r1->ri.ri_addr;
+ if(r2->ri.ri_addr){
+ *orgsize = r2->ri.ri_addr - r1->ri.ri_addr;
+ }else{
+ *orgsize = r1->ri.ri_addr;
+ }
}
/**
--
1.7.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [PATCH] gfs2_grow: Fix gfs2_grow when only one RG is present
2011-08-11 19:37 [Cluster-devel] [PATCH] gfs2_grow: Fix gfs2_grow when only one RG is present Carlos Maiolino
@ 2011-08-12 8:53 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2011-08-12 8:53 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
On Thu, 2011-08-11 at 16:37 -0300, Carlos Maiolino wrote:
> If there is only one RG in the filesystem
> gfs2_grow will make a subtraction using a
> null pointer to check the RG size returning
> a invalide RG size value.
> This patch avoid this substraction if there is
> only one RG in the filesystem.
> ---
> gfs2/mkfs/main_grow.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
> index 0eca396..d7a81a3 100644
> --- a/gfs2/mkfs/main_grow.c
> +++ b/gfs2/mkfs/main_grow.c
> @@ -133,7 +133,11 @@ static void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *orgsize)
> r1 = osi_list_entry(head->next->next, struct rgrp_list, list);
> r2 = osi_list_entry(head->next->next->next, struct rgrp_list, list);
>
> - *orgsize = r2->ri.ri_addr - r1->ri.ri_addr;
> + if(r2->ri.ri_addr){
> + *orgsize = r2->ri.ri_addr - r1->ri.ri_addr;
> + }else{
> + *orgsize = r1->ri.ri_addr;
> + }
> }
>
> /**
If this is trying to figure out the length of the rgrp, then it doesn't
look quite right to me... ri_addr is the location of the rgrp header on
disk, which is fair enough. However when you have only a single rgrp,
the size should be something like ri_length + ri_data since ri_length is
the size of the rgrp header itself and ri_data is the number of data
blocks. The result may have to be suitably aligned in order to match
what mkfs would do.
Also, the advantage of computing it like that is that only a single rgrp
is needed, so that the case of using two and subtracting the two
starting addresses can go away then making the code rather simpler,
Steve.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-12 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 19:37 [Cluster-devel] [PATCH] gfs2_grow: Fix gfs2_grow when only one RG is present Carlos Maiolino
2011-08-12 8:53 ` 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).