bin/66763: mdmfs: sync arguments with those of newfs, disallow '-l' in compatibility mode

Alex Vasylenko lxv at omut.org
Mon May 17 10:10:17 PDT 2004


>Number:         66763
>Category:       bin
>Synopsis:       mdmfs: sync arguments with those of newfs, disallow '-l' in compatibility mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 17 10:10:15 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Alex Vasylenko
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
>Environment:
System: FreeBSD 5.2-CURRENT #6: Sat May 15 14:17:15 EDT 2004


>Description:
	1. The '-n' flag to mdmfs(8) currently gets passed to newfs(8).
	However, this flag is no longer supported by newfs(8), so the command
	is going to fail. Make mdmfs(8) ignore the flag in compatibility mode;
	remove the support for this flag when in normal mode.

	2. The new '-l' flag is permitted when mdmfs(8) is run in compatibility
	mode (either 'mdmfs -C' or 'mount_mfs'), but it should not be. 

	NOTE: Do we still need the compatibility mode? (would be a nice if it's
	gone, as some useful options can't be used with mdmfs from fstab(5)).

	3. Synchronize parameter names with those of newfs(8) for arguments
	passed to newfs(8):
	-c: cylinders -> blocks-per-cylinder-group
	-d: rotdelay -> max-extent-size

	4. Note in the man page that '-l' is passed to newfs(8)

>How-To-Repeat:
	mdmfs -n 32 -s 32m md /mnt
	mdmfs -C -l -s 32m md /mnt

>Fix:

Index: mdmfs.c
===================================================================
RCS file: /home/ncvs/src/sbin/mdmfs/mdmfs.c,v
retrieving revision 1.20
diff -u -p -r1.20 mdmfs.c
--- mdmfs.c	17 May 2004 07:07:20 -0000	1.20
+++ mdmfs.c	17 May 2004 15:59:53 -0000
@@ -168,6 +168,8 @@ main(int argc, char **argv)
 			loudsubs = true;
 			break;
 		case 'l':
+			if (compat)
+				usage();
 			argappend(&newfs_arg, "-l");
 			break;
 		case 'M':
@@ -185,7 +187,8 @@ main(int argc, char **argv)
 			norun = true;
 			break;
 		case 'n':
-			argappend(&newfs_arg, "-n %s", optarg);
+			if (!compat)
+				usage();
 			break;
 		case 'O':
 			argappend(&newfs_arg, "-o %s", optarg);
@@ -665,14 +668,14 @@ usage(void)
 		name = "mdmfs";
 	if (!compat)
 		fprintf(stderr,
-"usage: %s [-DLlMNSUX] [-a maxcontig [-b block-size] [-c cylinders]\n"
-"\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n"
-"\t[-m percent-free] [-n rotational-positions] [-O optimization]\n"
+"usage: %s [-DLlMNSUX] [-a maxcontig [-b block-size] [-c blocks-per-cylinder-group]\n"
+"\t[-d max-extent-size] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n"
+"\t[-m percent-free] [-O optimization]\n"
 "\t[-o mount-options] [-p permissions] [-s size] [-w user:group]\n"
 "\tmd-device mount-point\n", name);
 	fprintf(stderr,
-"usage: %s -C [-lNU] [-a maxcontig] [-b block-size] [-c cylinders]\n"
-"\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n"
+"usage: %s -C [-NU] [-a maxcontig] [-b block-size] [-c blocks-per-cylinder-group]\n"
+"\t[-d max-extent-size] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n"
 "\t[-m percent-free] [-n rotational-positions] [-O optimization]\n"
 "\t[-o mount-options] [-s size] md-device mount-point\n", name);
 	exit(1);


Index: mdmfs.8
===================================================================
RCS file: /home/ncvs/src/sbin/mdmfs/mdmfs.8,v
retrieving revision 1.20
diff -u -r1.20 mdmfs.8
--- mdmfs.8	17 May 2004 08:35:41 -0000	1.20
+++ mdmfs.8	17 May 2004 16:04:20 -0000
@@ -39,14 +39,13 @@
 .Op Fl DLlMNSUX
 .Op Fl a Ar maxcontig
 .Op Fl b Ar block-size
-.Op Fl c Ar cylinders
-.Op Fl d Ar rotdelay
+.Op Fl c Ar blocks-per-cylinder-group
+.Op Fl d Ar max-extent-size
 .Op Fl e Ar maxbpg
 .Op Fl F Ar file
 .Op Fl f Ar frag-size
 .Op Fl i Ar bytes
 .Op Fl m Ar percent-free
-.Op Fl n Ar rotational-positions
 .Op Fl O Ar optimization
 .Op Fl o Ar mount-options
 .Op Fl p Ar permissions
@@ -60,8 +59,8 @@
 .Op Fl lNU
 .Op Fl a Ar maxcontig
 .Op Fl b Ar block-size
-.Op Fl c Ar cylinders
-.Op Fl d Ar rotdelay
+.Op Fl c Ar blocks-per-cylinder-group
+.Op Fl d Ar max-extent-size
 .Op Fl e Ar maxbpg
 .Op Fl F Ar file
 .Op Fl f Ar frag-size
@@ -130,25 +129,30 @@
 option).
 .It Fl b Ar block-size
 The block size of the file system, in bytes.
+See
+.Xr newfs 8
+for details.
 .It Fl C
 Enable full compatibility mode with
 .Xr mount_mfs 8 .
 See the
 .Sx COMPATIBILITY
 section for more information.
-.It Fl c Ar cylinders
-The number of cylinders per cylinder group in the file system.
+.It Fl c Ar blocks-per-cylinder-group
+The number of blocks per cylinder group in a file system.
+See
+.Xr newfs 8
+for details.
 .It Fl D
 If not using auto-unit,
 do not run
 .Xr mdconfig 8
 to try to detach the unit before attaching it.
-.It Fl d Ar rotdelay
-Specify the minimum time in milliseconds required to initiate another
-disk transfer on the same cylinder.
-Modern disks with read/write-behind achieve higher performance without
-this feature,
-so it is best to leave it at 0 milliseconds.
+.It Fl d Ar max-extent-size
+The file system may choose to store large files using extents.
+This parameter specifies the largest extent size that may be used.
+It is presently limited to its default value which is 16 times
+the file system blocksize.
 .It Fl e Ar maxbpg
 Indicate the maximum number of blocks any single file can allocate
 out of a cylinder group before it is forced to begin allocating
@@ -182,7 +186,7 @@
 This is most useful in conjunction with
 .Fl X .
 .It Fl n Ar rotational-positions
-The default number of rotational positions to distinguish.
+This option is obsolete and is supported for compatibility only.
 .It Fl O Ar optimization
 Select the optimization preference;
 valid choices are
@@ -277,9 +281,9 @@
 .Fl s ,
 respectively.
 The
-.Fl a , b , c , d , e , f , i , m
+.Fl a , b , c , d , e , f , i , l
 and
-.Fl n
+.Fl m
 options are passed to
 .Xr newfs 8
 with the same letter;
@@ -288,7 +292,13 @@
 option is passed to
 .Xr newfs 8
 as
-.Fl o .
+.Fl o ;
+the
+.Fl v
+option is passed to
+.Xr newfs 8
+as
+.Fl O .
 The
 .Fl o
 option is passed to
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list