From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 6/6] libgfs2: Clarify gfs2_compute_bitstructs's parameters
Date: Tue, 14 May 2013 11:54:49 +0100 [thread overview]
Message-ID: <1368528889.2711.15.camel@menhir> (raw)
In-Reply-To: <1368528337-4236-7-git-send-email-anprice@redhat.com>
Hi,
Other patches all look good too. Thanks,
Steve.
On Tue, 2013-05-14 at 11:45 +0100, Andrew Price wrote:
> gfs2_compute_bitstructs accepted an sdp and only used it to look up the
> block size. Replace the sdp parameter with a bsize parameter to make it
> easier to reason through code which uses this function.
>
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
> gfs2/convert/gfs2_convert.c | 2 +-
> gfs2/fsck/rgrepair.c | 6 +++---
> gfs2/libgfs2/fs_geometry.c | 2 +-
> gfs2/libgfs2/libgfs2.h | 2 +-
> gfs2/libgfs2/rgrp.c | 10 +++++-----
> gfs2/libgfs2/super.c | 2 +-
> gfs2/mkfs/main_mkfs.c | 2 +-
> 7 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
> index d286512..d4bad1d 100644
> --- a/gfs2/convert/gfs2_convert.c
> +++ b/gfs2/convert/gfs2_convert.c
> @@ -1898,7 +1898,7 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
> rgd->bh[x] = bget(sdp, rgd->ri.ri_addr + x);
> memset(rgd->bh[x]->b_data, 0, sdp->bsize);
> }
> - if (gfs2_compute_bitstructs(sdp, rgd)) {
> + if (gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, rgd)) {
> log_crit(_("gfs2_convert: Error converting bitmaps.\n"));
> exit(-1);
> }
> diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
> index 27368a2..1ebdc70 100644
> --- a/gfs2/fsck/rgrepair.c
> +++ b/gfs2/fsck/rgrepair.c
> @@ -503,7 +503,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs,
> break; /* end of bitmap, so call it quits. */
> } /* for subsequent bitmaps */
>
> - gfs2_compute_bitstructs(sdp, calc_rgd);
> + gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, calc_rgd);
> calc_rgd->ri.ri_data0 = calc_rgd->ri.ri_addr +
> calc_rgd->ri.ri_length;
> if (prev_rgd) {
> @@ -732,7 +732,7 @@ static int expect_rindex_sanity(struct gfs2_sbd *sdp, int *num_rgs)
> memcpy(&exp->rg, &rgd->rg, sizeof(exp->rg));
> exp->bits = NULL;
> exp->bh = NULL;
> - gfs2_compute_bitstructs(sdp, exp);
> + gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, exp);
> }
> sdp->rgrps = *num_rgs;
> return 0;
> @@ -948,7 +948,7 @@ int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count, int *sane)
> }
> else
> log_err( _("rindex not fixed.\n"));
> - gfs2_compute_bitstructs(sdp, actual);
> + gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, actual);
> rindex_modified = FALSE;
> }
> e = enext;
> diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
> index e716127..932a2e6 100644
> --- a/gfs2/libgfs2/fs_geometry.c
> +++ b/gfs2/libgfs2/fs_geometry.c
> @@ -207,7 +207,7 @@ void build_rgrps(struct gfs2_sbd *sdp, int do_write)
> rl->rg.rg_header.mh_format = GFS2_FORMAT_RG;
> rl->rg.rg_free = rgblocks;
>
> - if (gfs2_compute_bitstructs(sdp, rl)) {
> + if (gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, rl)) {
> fprintf(stderr, "%s: Unable to build resource groups "
> "with these characteristics.\n", __FUNCTION__);
> exit(-1);
> diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
> index e069e9d..997e23f 100644
> --- a/gfs2/libgfs2/libgfs2.h
> +++ b/gfs2/libgfs2/libgfs2.h
> @@ -725,7 +725,7 @@ extern int gfs2_find_jhead(struct gfs2_inode *ip, struct gfs2_log_header *head);
> extern int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head);
>
> /* rgrp.c */
> -extern int gfs2_compute_bitstructs(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
> +extern int gfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd);
> extern struct rgrp_tree *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk);
> extern uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
> extern void gfs2_rgrp_relse(struct rgrp_tree *rgd);
> diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
> index f7dc01e..f2b8304 100644
> --- a/gfs2/libgfs2/rgrp.c
> +++ b/gfs2/libgfs2/rgrp.c
> @@ -12,11 +12,11 @@
>
> /**
> * gfs2_compute_bitstructs - Compute the bitmap sizes
> - * @rgd: The resource group descriptor
> - *
> + * bsize: Block size
> + * rgd: The resource group descriptor
> * Returns: 0 on success, -1 on error
> */
> -int gfs2_compute_bitstructs(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
> +int gfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd)
> {
> struct gfs2_bitmap *bits;
> uint32_t length = rgd->ri.ri_length;
> @@ -49,7 +49,7 @@ int gfs2_compute_bitstructs(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
> bits->bi_len = bytes;
> }
> else if (x == 0){
> - bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_rgrp);
> + bytes = bsize - sizeof(struct gfs2_rgrp);
> bits->bi_offset = sizeof(struct gfs2_rgrp);
> bits->bi_start = 0;
> bits->bi_len = bytes;
> @@ -61,7 +61,7 @@ int gfs2_compute_bitstructs(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
> bits->bi_len = bytes;
> }
> else{
> - bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
> + bytes = bsize - sizeof(struct gfs2_meta_header);
> bits->bi_offset = sizeof(struct gfs2_meta_header);
> bits->bi_start = rgd->ri.ri_bitbytes - bytes_left;
> bits->bi_len = bytes;
> diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
> index 21c9f7b..eb97c40 100644
> --- a/gfs2/libgfs2/super.c
> +++ b/gfs2/libgfs2/super.c
> @@ -188,7 +188,7 @@ int rindex_read(struct gfs2_sbd *sdp, int fd, int *count1, int *sane)
> prev_rgd->length = rgrp_size(prev_rgd);
> }
>
> - if(gfs2_compute_bitstructs(sdp, rgd))
> + if(gfs2_compute_bitstructs(sdp->sd_sb.sb_bsize, rgd))
> *sane = 0;
>
> (*count1)++;
> diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
> index aadd501..76b34b8 100644
> --- a/gfs2/mkfs/main_mkfs.c
> +++ b/gfs2/mkfs/main_mkfs.c
> @@ -613,7 +613,7 @@ static int place_rgrps(struct gfs2_sbd *sdp, const struct mkfs_opts *opts)
>
> /* TODO: This call allocates buffer heads and bitmap pointers
> * in rgt. We really shouldn't need to do that. */
> - err = gfs2_compute_bitstructs(sdp, rgt);
> + err = gfs2_compute_bitstructs(sdp->bsize, rgt);
> if (err != 0) {
> fprintf(stderr, _("Could not compute bitmaps. "
> "Check resource group and block size options.\n"));
next prev parent reply other threads:[~2013-05-14 10:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-14 10:45 [Cluster-devel] [PATCH 0/6] More mkfs.gfs2 reworking Andrew Price
2013-05-14 10:45 ` [Cluster-devel] [PATCH 1/6] mkfs.gfs2: Add options for stripe size and width Andrew Price
2013-05-14 10:49 ` Steven Whitehouse
2013-05-14 11:21 ` Andrew Price
2013-05-14 12:53 ` [Cluster-devel] [PATCH 1/6 v2] " Andrew Price
2013-05-14 12:52 ` Steven Whitehouse
2013-05-14 10:45 ` [Cluster-devel] [PATCH 2/6] libgfs2: Remove 'writes' field from gfs2_sbd Andrew Price
2013-05-14 10:45 ` [Cluster-devel] [PATCH 3/6] mkfs.gfs2: Link to libblkid Andrew Price
2013-05-14 10:45 ` [Cluster-devel] [PATCH 4/6] mkfs.gfs2: Use libblkid for checking contents Andrew Price
2013-05-14 10:52 ` Steven Whitehouse
2013-05-14 11:00 ` Andrew Price
2013-05-14 10:45 ` [Cluster-devel] [PATCH 5/6] mkfs.gfs2: Add a struct to store device info Andrew Price
2013-05-14 10:45 ` [Cluster-devel] [PATCH 6/6] libgfs2: Clarify gfs2_compute_bitstructs's parameters Andrew Price
2013-05-14 10:54 ` Steven Whitehouse [this message]
2013-05-14 12:21 ` [Cluster-devel] [PATCH 0/6] More mkfs.gfs2 reworking Bob Peterson
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=1368528889.2711.15.camel@menhir \
--to=swhiteho@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 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).