From owner-freebsd-bugs Mon Oct 15 3:20:10 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8E83E37B40D for ; Mon, 15 Oct 2001 03:20:04 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f9FAK4a06303; Mon, 15 Oct 2001 03:20:04 -0700 (PDT) (envelope-from gnats) Date: Mon, 15 Oct 2001 03:20:04 -0700 (PDT) Message-Id: <200110151020.f9FAK4a06303@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: "Crist J. Clark" Subject: Re: bin/31199: tunefs error is incorrect when enabling softupdates Reply-To: "Crist J. Clark" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/31199; it has been noted by GNATS. From: "Crist J. Clark" To: Rob Simmons 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 " 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