From: Christoph Hellwig <hch@infradead.org>
To: Wengang Wang <wen.gang.wang@oracle.com>
Cc: greg.marsden@oracle.com, joe.jin@oracle.com, xfs@oss.sgi.com
Subject: Re: different error messages for mkfs.xfs -ssize
Date: Thu, 22 Apr 2010 12:46:32 -0400 [thread overview]
Message-ID: <20100422164632.GA25662@infradead.org> (raw)
In-Reply-To: <20100422153636.GB3822@laptop.oracle.com>
On Thu, Apr 22, 2010 at 11:36:36PM +0800, Wengang Wang wrote:
> Hi experts,
>
> I got different error messages when provide different value for -ssize.
> Why the error messages are different? They are different but no one is
> containing more info than the other.
>
> [root@desk test-xfsprogs]# mkfs.xfs -ssize=256 /dev/sda10 -f 2>&1 |head -n 1
> illegal sector size 256
> [root@desk test-xfsprogs]# mkfs.xfs -ssize=3072 /dev/sda10 -f 2>&1 |head -n 1
> Illegal value 3072 for -s sectsize option
It's because we have an early test that just tests for the value beeing
negative or not a power of two, and a later one that checks for the
exact range. The untested patch below cleans this up a bit, but once
I get started on this I might do an even bigger sweep on the mkfs
option parsing and error handling..
Index: xfsprogs-dev/mkfs/xfs_mkfs.c
===================================================================
--- xfsprogs-dev.orig/mkfs/xfs_mkfs.c 2010-04-22 18:32:16.708004506 +0200
+++ xfsprogs-dev/mkfs/xfs_mkfs.c 2010-04-22 18:36:49.217255590 +0200
@@ -1540,8 +1540,6 @@ main(
conflict('s', sopts, S_SECTSIZE,
S_SECTLOG);
sectorlog = atoi(value);
- if (sectorlog <= 0)
- illegal(value, "s sectlog");
lsectorlog = sectorlog;
sectorsize = 1 << sectorlog;
lsectorsize = sectorsize;
@@ -1558,9 +1556,6 @@ main(
S_SECTSIZE);
sectorsize = cvtnum(
blocksize, sectorsize, value);
- if (sectorsize <= 0 ||
- !ispow2(sectorsize))
- illegal(value, "s sectsize");
lsectorsize = sectorsize;
sectorlog =
libxfs_highbit32(sectorsize);
@@ -1637,7 +1632,9 @@ main(
}
if (sectorsize < XFS_MIN_SECTORSIZE ||
- sectorsize > XFS_MAX_SECTORSIZE || sectorsize > blocksize) {
+ sectorsize > XFS_MAX_SECTORSIZE ||
+ sectorsize > blocksize ||
+ !ispow2(sectorsize)) {
fprintf(stderr, _("illegal sector size %d\n"), sectorsize);
usage();
}
@@ -1647,7 +1644,9 @@ main(
usage();
}
if (lsectorsize < XFS_MIN_SECTORSIZE ||
- lsectorsize > XFS_MAX_SECTORSIZE || lsectorsize > blocksize) {
+ lsectorsize > XFS_MAX_SECTORSIZE ||
+ lsectorsize > blocksize ||
+ !ispow2(lsectorsize)) {
fprintf(stderr, _("illegal log sector size %d\n"), lsectorsize);
usage();
} else if (lsectorsize > XFS_MIN_SECTORSIZE && !lsu && !lsunit) {
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2010-04-22 16:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-22 15:36 different error messages for mkfs.xfs -ssize Wengang Wang
2010-04-22 16:18 ` Kinzel, David
2010-04-23 2:48 ` Wengang Wang
2010-04-22 16:46 ` Christoph Hellwig [this message]
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=20100422164632.GA25662@infradead.org \
--to=hch@infradead.org \
--cc=greg.marsden@oracle.com \
--cc=joe.jin@oracle.com \
--cc=wen.gang.wang@oracle.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