From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 3/8] mkfs.gfs2: Pull place_journals() out of place_rgrps()
Date: Thu, 7 Dec 2017 11:53:34 +0000 [thread overview]
Message-ID: <20171207115339.3797-4-anprice@redhat.com> (raw)
In-Reply-To: <20171207115339.3797-1-anprice@redhat.com>
Removes some clutter from place_rgrps() and makes main() a little more
informative.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/mkfs/main_mkfs.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 2e08bc62..3b774115 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -713,7 +713,6 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_o
uint32_t rgsize = lgfs2_rgsize_for_data(jfsize, sdp->bsize);
unsigned j;
- /* Initialise a progress bar for resource group creation. */
gfs2_progress_init(&progress, opts->journals, _("Adding journals: "), opts->quiet);
/* We'll build the jindex later so remember where we put the journals */
@@ -728,7 +727,6 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_o
lgfs2_rgrp_t rg;
struct gfs2_inode in = {0};
- /* Update progress bar for journal creation. */
gfs2_progress_update(&progress, (j + 1));
if (opts->debug)
@@ -783,26 +781,19 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_o
return 0;
}
-static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_opts *opts)
+static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, uint64_t *rgaddr, struct mkfs_opts *opts)
{
struct gfs2_progress_bar progress;
- uint64_t rgaddr = lgfs2_rgrp_align_addr(rgs, sdp->sb_addr + 1);
uint32_t rgblks = ((opts->rgsize << 20) / sdp->bsize);
uint32_t rgnum;
int result;
- result = place_journals(sdp, rgs, opts, &rgaddr);
- if (result != 0)
- return result;
-
- rgnum = lgfs2_rgrps_plan(rgs, sdp->device.length - rgaddr, rgblks);
-
- /* Initialise a progress bar for resource group creation (after journal creation). */
+ rgnum = lgfs2_rgrps_plan(rgs, sdp->device.length - *rgaddr, rgblks);
gfs2_progress_init(&progress, (rgnum + opts->journals), _("Building resource groups: "), opts->quiet);
while (1) {
lgfs2_rgrp_t rg;
- result = add_rgrp(rgs, &rgaddr, 0, &rg);
+ result = add_rgrp(rgs, rgaddr, 0, &rg);
if (result > 0)
break;
else if (result < 0)
@@ -814,7 +805,6 @@ static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_opts
return result;
}
- /* Update progress bar with resource group address. */
gfs2_progress_update(&progress, (sdp->rgrps));
}
gfs2_progress_close(&progress, _("Done\n"));
@@ -944,6 +934,7 @@ int main(int argc, char *argv[])
struct gfs2_sb sb;
struct mkfs_opts opts;
lgfs2_rgrps_t rgs;
+ uint64_t rgaddr;
int error;
unsigned bsize;
@@ -993,8 +984,13 @@ int main(int argc, char *argv[])
if (!opts.quiet)
printf("%s", _("Done\n"));
}
-
- error = place_rgrps(&sbd, rgs, &opts);
+ rgaddr = lgfs2_rgrp_align_addr(rgs, sbd.sb_addr + 1);
+ error = place_journals(&sbd, rgs, &opts, &rgaddr);
+ if (error != 0) {
+ fprintf(stderr, _("Failed to create journals\n"));
+ exit(1);
+ }
+ error = place_rgrps(&sbd, rgs, &rgaddr, &opts);
if (error) {
fprintf(stderr, _("Failed to build resource groups\n"));
exit(1);
--
2.13.6
next prev parent reply other threads:[~2017-12-07 11:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 11:53 [Cluster-devel] [PATCH 0/8] gfs2-utils: Add support for new resource group fields Andrew Price
2017-12-07 11:53 ` [Cluster-devel] [PATCH 1/8] gfs2-utils configure: Check for rg_skip Andrew Price
2017-12-07 11:53 ` [Cluster-devel] [PATCH 2/8] libgfs2: Add rgrp_skip support Andrew Price
2017-12-07 11:53 ` Andrew Price [this message]
2017-12-07 11:53 ` [Cluster-devel] [PATCH 4/8] mkfs.gfs2: Set the rg_skip field in new rgrps Andrew Price
2017-12-07 13:29 ` Bob Peterson
2017-12-07 14:14 ` Andrew Price
2017-12-07 11:53 ` [Cluster-devel] [PATCH 5/8] gfs2-utils configure: Check for rg_data0, rg_data and rg_bitbytes Andrew Price
2017-12-07 13:29 ` Bob Peterson
2017-12-07 11:53 ` [Cluster-devel] [PATCH 6/8] libgfs2: Add support " Andrew Price
2017-12-07 13:30 ` Bob Peterson
2017-12-07 11:53 ` [Cluster-devel] [PATCH 7/8] mkfs.gfs2: Set the rg_data0, rg_data and rg_bitbytes fields Andrew Price
2017-12-07 13:31 ` Bob Peterson
2017-12-07 11:53 ` [Cluster-devel] [PATCH 8/8] libgfs2: Add support for rg_crc Andrew Price
2017-12-07 12:06 ` Steven Whitehouse
2017-12-07 13:53 ` Bob Peterson
2017-12-07 15:42 ` 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=20171207115339.3797-4-anprice@redhat.com \
--to=anprice@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.