xfs
[Top] [All Lists]

[PATCH] xfsprogs: merge the duplicated condition in xfs_mkfs.c/validate_

To: xfs@xxxxxxxxxxx, dchinner@xxxxxxxxxx, david@xxxxxxxxxxxxx, bfoster@xxxxxxxxxx
Subject: [PATCH] xfsprogs: merge the duplicated condition in xfs_mkfs.c/validate_ag_geometry
From: Wang Sheng-Hui <shhuiw@xxxxxxxxxxx>
Date: Thu, 28 May 2015 15:06:48 +0800
Delivered-to: xfs@xxxxxxxxxxx
Some conditions are duplicated. Merge them.

Signed-off-by: Wang Sheng-Hui <shhuiw@xxxxxxxxxxx>
---
 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




<Prev in Thread] Current Thread [Next in Thread>