From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] libgfs2: Return the rgrp count in lgfs2_rgrps_plan()
Date: Mon, 12 Oct 2015 11:47:37 -0400 (EDT) [thread overview]
Message-ID: <1169191743.44604397.1444664857224.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1444663364-6364-1-git-send-email-anprice@redhat.com>
----- 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 <anprice@redhat.com>
> ---
> 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
next prev parent reply other threads:[~2015-10-12 15:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 15:22 [Cluster-devel] [PATCH] libgfs2: Return the rgrp count in lgfs2_rgrps_plan() Andrew Price
2015-10-12 15:47 ` Bob Peterson [this message]
2015-10-12 17:14 ` Andrew Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1169191743.44604397.1444664857224.JavaMail.zimbra@redhat.com \
--to=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.