From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Mon, 12 Oct 2015 11:47:37 -0400 (EDT) Subject: [Cluster-devel] [PATCH] libgfs2: Return the rgrp count in lgfs2_rgrps_plan() In-Reply-To: <1444663364-6364-1-git-send-email-anprice@redhat.com> References: <1444663364-6364-1-git-send-email-anprice@redhat.com> Message-ID: <1169191743.44604397.1444664857224.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- > lgfs2_rgrps_plan() previously returned one of the rgrp sizes > specifically so that gfs2_grow could check it. This check was also done > inside the function so the return value would always be 0 when the rgrp > size was too small anyway (really this means that there's not enough > space in which to place sensibly sized rgrps). As returning 0 is > sufficient to pass back the same information, we can return the resource > group count from lgfs2_rgrps_plan() instead, as that is a more useful > value in general. > > Signed-off-by: Andrew Price > --- > gfs2/libgfs2/rgrp.c | 7 +++---- > gfs2/mkfs/main_grow.c | 8 +++----- > 2 files changed, 6 insertions(+), 9 deletions(-) > > diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c > index cf4385a..b14d210 100644 > --- a/gfs2/libgfs2/rgrp.c > +++ b/gfs2/libgfs2/rgrp.c > @@ -302,8 +302,8 @@ uint32_t lgfs2_rgrp_align_len(const lgfs2_rgrps_t rgs, > uint32_t len) > * rgs: The resource groups descriptor > * space: The number of remaining blocks to be allocated > * tgtsize: The target resource group size in blocks > - * Returns the larger of the calculated resource group sizes, in blocks, or > 0 > - * if the smaller would be less than GFS2_MIN_RGSIZE. > + * Returns the number of resource groups planned to fit in the given space, > or > + * 0 if the smallest resource group would be smaller than GFS2_MIN_RGSIZE. > */ > uint32_t lgfs2_rgrps_plan(const lgfs2_rgrps_t rgs, uint64_t space, uint32_t > tgtsize) > { > @@ -352,11 +352,10 @@ uint32_t lgfs2_rgrps_plan(const lgfs2_rgrps_t rgs, > uint64_t space, uint32_t tgts > /* Once we've reached this point, > (plan[0].num * plan[0].len) + (plan[1].num * plan[1].len) > will be less than one adjustment smaller than 'space'. */ > - > if (rgs->plan[0].len < minlen) > return 0; > > - return rgs->plan[0].len; > + return rgs->plan[0].num + rgs->plan[1].num; Hi Andy, Does this all work with a tiny file system that only has one resource group? I remember trying to code similar things and Abhi kept having to fix it because of problems with single-rgrp file systems. Bear in mind, I haven't looked at the rest of this function in detail, so I'm speaking somewhat out of ignorance. Regards, Bob Peterson Red Hat File Systems