Add a new sysctl variable vfs.ffs.log_changeopt - if this is true,

an optimalization strategy change is logged into syslog. Default
is 0 (to not log). This replaces the recent not quite "right"
change to only log the change if kernel is compiled with DEBUG.
This commit is contained in:
jdolecek 2000-04-04 09:23:20 +00:00
parent bfb0ad4a93
commit c78399fc88
3 changed files with 27 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_alloc.c,v 1.33 2000/03/30 12:41:12 augustss Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.34 2000/04/04 09:23:20 jdolecek Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -79,6 +79,9 @@ static ufs_daddr_t ffs_mapsearch __P((struct fs *, struct cg *,
static int ffs_checkblk __P((struct inode *, ufs_daddr_t, long size));
#endif
/* if 1, changes in optimalization strategy are logged */
int ffs_log_changeopt = 0;
/* in ffs_tables.c */
extern int inside[], around[];
extern u_char *fragtbl[];
@ -251,10 +254,13 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
fs->fs_cstotal.cs_nffree >
fs->fs_dsize * fs->fs_minfree / (2 * 100))
break;
#ifdef DEBUG
log(LOG_NOTICE, "%s: optimization changed from SPACE to TIME\n",
fs->fs_fsmnt);
#endif
if (ffs_log_changeopt) {
log(LOG_NOTICE,
"%s: optimization changed from SPACE to TIME\n",
fs->fs_fsmnt);
}
fs->fs_optim = FS_OPTTIME;
break;
case FS_OPTTIME:
@ -272,10 +278,13 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
if (fs->fs_cstotal.cs_nffree <
fs->fs_dsize * (fs->fs_minfree - 2) / 100)
break;
#ifdef DEBUG
log(LOG_NOTICE, "%s: optimization changed from TIME to SPACE\n",
fs->fs_fsmnt);
#endif
if (ffs_log_changeopt) {
log(LOG_NOTICE,
"%s: optimization changed from TIME to SPACE\n",
fs->fs_fsmnt);
}
fs->fs_optim = FS_OPTSPACE;
break;
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_extern.h,v 1.15 2000/03/16 18:20:06 jdolecek Exp $ */
/* $NetBSD: ffs_extern.h,v 1.16 2000/04/04 09:23:20 jdolecek Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -42,7 +42,8 @@
#define FFS_CLUSTERWRITE 2 /* cluster writing enabled */
#define FFS_REALLOCBLKS 3 /* block reallocation enabled */
#define FFS_ASYNCFREE 4 /* asynchronous block freeing enabled */
#define FFS_MAXID 5 /* number of valid ffs ids */
#define FFS_LOG_CHANGEOPT 5 /* log optimalization strategy change */
#define FFS_MAXID 6 /* number of valid ffs ids */
#define FFS_NAMES { \
{ 0, 0 }, \
@ -50,6 +51,7 @@
{ "doclusterwrite", CTLTYPE_INT }, \
{ "doreallocblks", CTLTYPE_INT }, \
{ "doasyncfree", CTLTYPE_INT }, \
{ "log_changeopt", CTLTYPE_INT }, \
}
struct buf;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.61 2000/03/30 12:41:12 augustss Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.62 2000/04/04 09:23:20 jdolecek Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -1138,6 +1138,7 @@ ffs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
struct proc *p;
{
extern int doclusterread, doclusterwrite, doreallocblks, doasyncfree;
extern int ffs_log_changeopt;
/* all sysctl names at this level are terminal */
if (namelen != 1)
@ -1155,6 +1156,9 @@ ffs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
&doreallocblks));
case FFS_ASYNCFREE:
return (sysctl_int(oldp, oldlenp, newp, newlen, &doasyncfree));
case FFS_LOG_CHANGEOPT:
return (sysctl_int(oldp, oldlenp, newp, newlen,
&ffs_log_changeopt));
default:
return (EOPNOTSUPP);
}