Skip to contentSkip to conversation

different error messages for mkfs.xfs -ssize

DISCUSSION Wengang Wang 3 participants 4 messages Apr 22, 2010 – Apr 23, 2010

lore
Share & tools
lore
#0 lore raw

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

regards,
wengang.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 8 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wengang Wang
Sent: Thursday, April 22, 2010 9:37 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: different error messages for mkfs.xfs -ssize

Quoted 5 lines

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.

1639         if (sectorsize < XFS_MIN_SECTORSIZE ||
1640             sectorsize > XFS_MAX_SECTORSIZE || sectorsize >

blocksize) {
1641 fprintf(stderr, _("illegal sector size %d\n"),
sectorsize);
1642 usage();
1643 }

According to the defaults:

62 #define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
64 #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)

Looks like your sectorsize is not greater than XFS_MIN_SECTORSIZE (illegal sector size)

For 3072,

1561 if (sectorsize <= 0 ||
1562 !ispow2(sectorsize))
1563 illegal(value, "s
sectsize");

3072 is not a power of two (illegal value)

Quoted 8 lines

[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

Quoted 8 lines

regards,
wengang.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

This email communication and any files transmitted with it may contain confidential and or proprietary information and is provided for the use of the intended recipient only. Any review, retransmission or dissemination of this information by anyone other than the intended recipient is prohibited. If you receive this email in error, please contact the sender and delete this communication and any copies immediately. Thank you.
http://www.encana.com

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 30 lines · David
Quoted 8 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wengang Wang
Sent: Thursday, April 22, 2010 9:37 AM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: different error messages for mkfs.xfs -ssize

Quoted 5 lines

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.

1639         if (sectorsize < XFS_MIN_SECTORSIZE ||
1640             sectorsize > XFS_MAX_SECTORSIZE || sectorsize >

blocksize) {
1641 fprintf(stderr, _("illegal sector size %d\n"),
sectorsize);
1642 usage();
1643 }

According to the defaults:

62 #define XFS_MIN_SECTORSIZE_LOG 9 /* i.e. 512 bytes */
64 #define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)

Looks like your sectorsize is not greater than XFS_MIN_SECTORSIZE (illegal sector size)

Quoted 8 lines

For 3072,

1561 if (sectorsize <= 0 ||
1562 !ispow2(sectorsize))
1563 illegal(value, "s
sectsize");

3072 is not a power of two (illegal value)

Yes. That are the places where different error messges are printed. I meant If there is no more info for a message than the other, It's better that the messages are the same.

Thanks a lot!

regards,
wengang.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
In reply to Wengang Wang
Quoted 10 lines · Wengang Wang

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..

mkfs/xfs_mkfs.c +6 -7
Index: xfsprogs-dev/mkfs/xfs_mkfs.c
===================================================================
@@ -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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs