Subject: Re: Problems with FFS optimization changes SPACE<->TIME
To: Thilo Manske <Thilo.Manske@HEH.Uni-Oldenburg.DE>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: current-users
Date: 10/09/1998 14:31:23

> optimization changed from TIME to SPACE

> optimization changed from SPACE to TIME

> So, my questions are:
> * What may cause this optimization switching?  (I noticed it before -
>   but with ~95% full cache, so I thought it was normal)

Way back when, the optimization was switched automatically when
crossing a certain fullness threshold, somewhere around 75% I think it
was (it's been a while).

But if you actually read the code, you'll see that it currently
switches based on how much of the available disk space is full blocks
and how much is fragments, which actually makes a whole lot more sense.
Look at src/sys/ufs/ffs/ffs_alloc.c, search for "optimization changed"
(the relevant switch starts on line 238, at least in ffs_alloc.c
version 1.23).

> * Have I've done something wrong?


> * Is it a worth a PR?

No, at least IMO.

> * Is it potentially dangerous?

No more than anything else that syslogs messages of comparable size
with comparable frequency.

I long ago got sufficiently fed up with getting those messages babbled
all over my syslog that I added this to my private patch tree:

--- OLD/sys/ufs/ffs/ffs_alloc.c	Thu Jan  1 00:00:00 1970
+++ NEW/sys/ufs/ffs/ffs_alloc.c	Thu Jan  1 00:00:00 1970
@@ -249,8 +249,10 @@
 		    fs->fs_cstotal.cs_nffree >
 		    fs->fs_dsize * fs->fs_minfree / (2 * 100))
 		log(LOG_NOTICE, "%s: optimization changed from SPACE to TIME\n",
 		fs->fs_optim = FS_OPTTIME;
 	case FS_OPTTIME:
@@ -268,8 +270,10 @@
 		if (fs->fs_cstotal.cs_nffree <
 		    fs->fs_dsize * (fs->fs_minfree - 2) / 100)
 		log(LOG_NOTICE, "%s: optimization changed from TIME to SPACE\n",
 		fs->fs_optim = FS_OPTSPACE;

And, of course, I never define FFS_LOG_OPTCHG in my kernel config
files. :-)  I suppose this really ought to be a sysctl (or maybe a
mount option), but so far I haven't been sufficiently motivated to turn
it into either.

					der Mouse

		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B