From pwroot@jhome.DIALix.COM  Sun Jun 25 07:48:14 1995
Received: from jhome.DIALix.COM (jhome.DIALix.COM [192.203.228.69])
          by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id HAA22711
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Jun 1995 07:48:09 -0700
Received: (from root@localhost) by jhome.DIALix.COM (8.6.11/8.6.9) id WAA00424; Sun, 25 Jun 1995 22:48:05 +0800
Message-Id: <199506251448.WAA00424@jhome.DIALix.COM>
Date: Sun, 25 Jun 1995 22:48:05 +0800
From: peter@haywire.dialix.com
Reply-To: peter@haywire.dialix.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: missing functionality in tunefs
X-Send-Pr-Version: 3.2

>Number:         561
>Category:       bin
>Synopsis:       missing functionality in tunefs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 25 07:50:02 1995
>Closed-Date:    Sun Jun 25 19:46:49 MET DST 1995
>Last-Modified:
>Originator:     Peter Wemm
>Release:        FreeBSD 2.0-BUILT-19950510 i386
>Organization:
DIALix Services
>Environment:

FreeBSD-current

FreeBSD jhome.DIALix.COM 2.0-BUILT-19950625 FreeBSD 2.0-BUILT-19950625 #4: Sun Jun 25 22:05:25 WST 1995     pwroot@jhome.DIALix.COM:/usr/src/sys/compile/JHOME  i386

>Description:

When tuneing filesystems with tunefs, it is not obvious what the current
parameters are.  You can use dumpfs, but that's not obvious which settings
are tuneable, and is far from clear to the non-guru (it's like using a 
hexdump of a tar archive to get a table-of-contents).

There is also an undocumented option in the man page that can be dangerous.
Suppose your disk driver decides to scramble all writes while you tell
tunefs to update all backup superblocks.

This suggested change adds a '-p' (print) switch to bring it in
line with some SVR4 systems.

# tunefs -p /dev/rsd0h
tunefs: maximum contiguous block count: (-a)               1
tunefs: rotational delay between contiguous blocks: (-d)   4 ms
tunefs: maximum blocks per file in a cylinder group: (-e)  1024
tunefs: minimum percentage of free space: (-m)             10%
tunefs: optimization preference: (-o)                      time

>How-To-Repeat:

Use tunefs and dumpfs.

>Fix:
	
Apply this patch to tunefs.c and tunefs.8

*** tunefs.old.c	Tue May 30 18:47:45 1995
--- tunefs.c	Sun Jun 25 22:38:57 1995
***************
*** 117,122 ****
--- 117,137 ----
  				Aflag++;
  				continue;
  
+ 			case 'p':
+ 				warnx("maximum contiguous block count: (-a)               %d", sblock.fs_maxcontig);
+ 				warnx("rotational delay between contiguous blocks: (-d)   %d ms", sblock.fs_rotdelay);
+ 				warnx("maximum blocks per file in a cylinder group: (-e)  %d", sblock.fs_maxbpg);
+ 				warnx("minimum percentage of free space: (-m)             %d%%", sblock.fs_minfree);
+ 				warnx("optimization preference: (-o)                      %s", sblock.fs_optim == FS_OPTSPACE ? "space" : "time");
+ 				if (sblock.fs_minfree >= MINFREE &&
+ 				    sblock.fs_optim == FS_OPTSPACE)
+ 					warnx(OPTWARN, "time", ">=", MINFREE);
+ 				if (sblock.fs_minfree < MINFREE &&
+ 				    sblock.fs_optim == FS_OPTTIME)
+ 					warnx(OPTWARN, "space", "<", MINFREE);
+ 
+ 				continue;
+ 
  			case 'a':
  				name = "maximum contiguous block count";
  				if (argc < 1)
***************
*** 233,238 ****
--- 248,254 ----
  	fprintf(stderr, "\t-e maximum blocks per file in a cylinder group\n");
  	fprintf(stderr, "\t-m minimum percentage of free space\n");
  	fprintf(stderr, "\t-o optimization preference (`space' or `time')\n");
+ 	fprintf(stderr, "\t-p no change - just prints current tuneable settings\n");
  	exit(2);
  }
  
*** tunefs.old.8	Wed Mar 15 17:10:47 1995
--- tunefs.8	Mon May 29 10:06:18 1995
***************
*** 39,48 ****
--- 39,50 ----
  .Nd tune up an existing file system
  .Sh SYNOPSIS
  .Nm tunefs
+ .Op Fl A
  .Op Fl a Ar maxcontig
  .Op Fl d Ar rotdelay
  .Op Fl e Ar maxbpg
  .Op Fl m Ar minfree
+ .Op Fl p
  .Bk -words
  .Op Fl o Ar optimize_preference
  .Ek
***************
*** 54,59 ****
--- 56,65 ----
  The parameters which are to be changed are indicated by the flags
  given below:
  .Bl -tag -width Ds
+ .It Fl A
+ The file system has several backups of the super-block.  Specifying
+ this option will cause all backups to be modified as well as the
+ primary super-block.  This is potentially dangerous - use with caution.
  .It Fl a Ar maxcontig
  This specifies the maximum number of contiguous blocks that will
  be laid out before forcing a rotational delay (see
***************
*** 103,108 ****
--- 109,120 ----
  higher overhead for file writes.
  The kernel normally changes the preference automatically as
  the percent fragmentation changes on the file system.
+ .It Fl p
+ This option shows a summary of what the current tuneable settings
+ are on the selected file system.  More detailed information can be
+ obtained in the
+ .Xr dumpfs 8
+ manual page.
  .El
  .Sh SEE ALSO
  .Xr fs 5 ,

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Sun Jun 25 19:46:49 MET DST 1995 
State-Changed-Why:  
Suggested fix applied (with minor, mostly optics, changes by me). 
>Unformatted:



