Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Oct 2001 03:20:04 -0700 (PDT)
From:      "Crist J. Clark" <cristjc@earthlink.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/31199: tunefs error is incorrect when enabling softupdates
Message-ID:  <200110151020.f9FAK4a06303@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/31199; it has been noted by GNATS.

From: "Crist J. Clark" <cristjc@earthlink.net>
To: Rob Simmons <rsimmons@mail.wlcg.com>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/31199: tunefs error is incorrect when enabling softupdates
Date: Mon, 15 Oct 2001 02:44:10 -0700

 On Wed, Oct 10, 2001 at 11:46:07AM -0400, Rob Simmons wrote:
 
 [snip]
 
 > When tunefs is used to enable softupdates, it gives conflicting mesages if
 > the filesystem is mounted.
 > >How-To-Repeat:
 > run "tunefs -n enable <fs>" on a mounted filesystem.
 > 
 > You will get the following output:
 > 
 > bash-2.05$ tunefs -n enable /dev/ad0s1a
 > tunefs: soft updates set
 > tunefs: cannot open /dev/ad0s1a: Permission denied
 
 Looking at the code, I think the least obtrusive way to fix this is to
 slightly reword the messages a little more clear. tunefs(8) goes
 through all of the options before it actually tries to modify the file
 system. The messages should reflect that it is collecting the values
 before it actually tries to write them. Something more like,
 
   $ tunefs -n enable /dev/ad0s1a
   tunefs: setting soft updates...
   tunefs: cannot open /dev/ad0s1a: Permission denied
 
 And in a successful run (since tunefs(8) is already chatty on
 success),
 
    $ tunefs -n enable /dev/ad0s1a
   tunefs: setting soft updates...
   tunefs: changes on /dev/ad0s1 done
 
 This patch look good?
 
 Index: tunefs.c
 ===================================================================
 RCS file: /export/ncvs/src/sbin/tunefs/tunefs.c,v
 retrieving revision 1.20
 diff -u -r1.20 tunefs.c
 --- tunefs.c	2001/09/30 14:57:08	1.20
 +++ tunefs.c	2001/10/15 09:43:07
 @@ -231,7 +231,7 @@
  			warnx("%s remains unchanged as %d", name, avalue);
  		}
  		else {
 -			warnx("%s changes from %d to %d",
 +			warnx("changing %s from %d to %d...",
  					name, sblock.fs_maxcontig, avalue);
  			sblock.fs_maxcontig = avalue;
  		}
 @@ -242,7 +242,7 @@
  			warnx("%s remains unchanged as %dms", name, dvalue);
  		}
  		else {
 -			warnx("%s changes from %dms to %dms",
 +			warnx("changing %s from %dms to %dms...",
  				    name, sblock.fs_rotdelay, dvalue);
  			sblock.fs_rotdelay = dvalue;
  		}
 @@ -253,7 +253,7 @@
  			warnx("%s remains unchanged as %d", name, evalue);
  		}
  		else {
 -			warnx("%s changes from %d to %d",
 +			warnx("changing %s from %d to %d...",
  					name, sblock.fs_maxbpg, evalue);
  			sblock.fs_maxbpg = evalue;
  		}
 @@ -264,7 +264,7 @@
  			warnx("%s remains unchanged as %d", name, fvalue);
  		}
  		else {
 -			warnx("%s changes from %d to %d",
 +			warnx("changing %s from %d to %d...",
  					name, sblock.fs_avgfilesize, fvalue);
  			sblock.fs_avgfilesize = fvalue;
  		}
 @@ -275,7 +275,7 @@
  			warnx("%s remains unchanged as %d%%", name, mvalue);
  		}
  		else {
 -			warnx("%s changes from %d%% to %d%%",
 +			warnx("changing %s from %d%% to %d%%...",
  				    name, sblock.fs_minfree, mvalue);
  			sblock.fs_minfree = mvalue;
  			if (mvalue >= MINFREE && sblock.fs_optim == FS_OPTSPACE)
 @@ -294,14 +294,14 @@
  				    name);
  			} else {
   				sblock.fs_flags |= FS_DOSOFTDEP;
 - 				warnx("%s set", name);
 + 				warnx("setting %s...", name);
  			}
   		} else if (strcmp(nvalue, "disable") == 0) {
  			if ((~sblock.fs_flags & FS_DOSOFTDEP) == FS_DOSOFTDEP) {
  				warnx("%s remains unchanged as disabled", name);
  			} else {
   				sblock.fs_flags &= ~FS_DOSOFTDEP;
 - 				warnx("%s cleared", name);
 + 				warnx("clearing %s...", name);
  			}
   		}
  	}
 @@ -313,7 +313,7 @@
  			warnx("%s remains unchanged as %s", name, chg[ovalue]);
  		}
  		else {
 -			warnx("%s changes from %s to %s",
 +			warnx("changing %s from %s to %s...",
  				    name, chg[sblock.fs_optim], chg[ovalue]);
  			sblock.fs_optim = ovalue;
  			if (sblock.fs_minfree >= MINFREE &&
 @@ -330,7 +330,7 @@
  			warnx("%s remains unchanged as %d", name, svalue);
  		}
  		else {
 -			warnx("%s changes from %d to %d",
 +			warnx("changing %s from %d to %d...",
  					name, sblock.fs_avgfpdir, svalue);
  			sblock.fs_avgfpdir = svalue;
  		}
 @@ -396,6 +396,7 @@
  		for (i = 0; i < fs->fs_ncg; i++)
  			bwrite(fsbtodb(fs, cgsblock(fs, i)),
  			    (const char *)fs, SBSIZE);
 +	warnx("changes on %s done", file);
  	close(fi);
  }
  
 
 -- 
 Crist J. Clark                     |     cjclark@alum.mit.edu
                                    |     cjclark@jhu.edu
 http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110151020.f9FAK4a06303>