public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Wang Sheng-Hui <shhuiw@foxmail.com>
To: xfs@oss.sgi.com, dchinner@redhat.com, david@fromorbit.com,
	bfoster@redhat.com
Subject: [PATCH] xfsprogs: merge the duplicated condition in xfs_mkfs.c/validate_ag_geometry
Date: Thu, 28 May 2015 15:06:48 +0800	[thread overview]
Message-ID: <1432796808-862-1-git-send-email-shhuiw@foxmail.com> (raw)

Some conditions are duplicated. Merge them.

Signed-off-by: Wang Sheng-Hui <shhuiw@foxmail.com>
---
 mkfs/xfs_mkfs.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index e2a052d..7ec2556 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -740,22 +740,6 @@ validate_ag_geometry(
 	__uint64_t	agsize,
 	__uint64_t	agcount)
 {
-	if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
-		fprintf(stderr,
-	_("agsize (%lld blocks) too small, need at least %lld blocks\n"),
-			(long long)agsize,
-			(long long)XFS_AG_MIN_BLOCKS(blocklog));
-		usage();
-	}
-
-	if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
-		fprintf(stderr,
-	_("agsize (%lld blocks) too big, maximum is %lld blocks\n"),
-			(long long)agsize,
-			(long long)XFS_AG_MAX_BLOCKS(blocklog));
-		usage();
-	}
-
 	if (agsize > dblocks) {
 		fprintf(stderr,
 	_("agsize (%lld blocks) too big, data area is %lld blocks\n"),
@@ -765,6 +749,10 @@ validate_ag_geometry(
 
 	if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
 		fprintf(stderr,
+	_("agsize (%lld blocks) too small, need at least %lld blocks\n"),
+			(long long)agsize,
+			(long long)XFS_AG_MIN_BLOCKS(blocklog));
+		fprintf(stderr,
 	_("too many allocation groups for size = %lld\n"),
 				(long long)agsize);
 		fprintf(stderr, _("need at most %lld allocation groups\n"),
@@ -775,6 +763,10 @@ validate_ag_geometry(
 
 	if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
 		fprintf(stderr,
+	_("agsize (%lld blocks) too big, maximum is %lld blocks\n"),
+			(long long)agsize,
+			(long long)XFS_AG_MAX_BLOCKS(blocklog));
+		fprintf(stderr,
 	_("too few allocation groups for size = %lld\n"), (long long)agsize);
 		fprintf(stderr,
 	_("need at least %lld allocation groups\n"),
-- 
1.8.3.2




_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2015-05-28  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28  7:06 Wang Sheng-Hui [this message]
2015-05-28 14:55 ` [PATCH] xfsprogs: merge the duplicated condition in xfs_mkfs.c/validate_ag_geometry Eric Sandeen
2015-05-29  0:05   ` Wang Sheng-Hui

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=1432796808-862-1-git-send-email-shhuiw@foxmail.com \
    --to=shhuiw@foxmail.com \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=xfs@oss.sgi.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