Keep track of the number of segments reclaimed, since the cleaner doesn't

do this anymore (it hasn't for quite some time).  Add a couple of conditional
debugging messages to indicate why segments are not cleaned, in the event
that lfs_segclean is used.

Make the LFCNSEGWAITALL fcntl work again.
This commit is contained in:
perseant 2005-05-20 19:48:25 +00:00
parent f8677583c3
commit 2ecd1730c0
3 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs.h,v 1.86 2005/04/23 19:47:51 perseant Exp $ */
/* $NetBSD: lfs.h,v 1.87 2005/05/20 19:48:25 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -1058,6 +1058,7 @@ struct lfs_stats { /* Must match sysctl list in lfs_vfsops.h ! */
u_int vflush_invoked;
u_int clean_inlocked;
u_int clean_vnlocked;
u_int segs_reclaimed;
};
#ifdef _KERNEL
extern struct lfs_stats lfs_stats;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_syscalls.c,v 1.105 2005/04/16 17:28:37 perseant Exp $ */
/* $NetBSD: lfs_syscalls.c,v 1.106 2005/05/20 19:48:25 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.105 2005/04/16 17:28:37 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_syscalls.c,v 1.106 2005/05/20 19:48:25 perseant Exp $");
#ifndef LFS
# define LFS /* for prototypes in syscallargs.h */
@ -893,10 +893,14 @@ lfs_do_segclean(struct lfs *fs, unsigned long segnum)
return (EBUSY);
}
if (sup->su_flags & SEGUSE_ACTIVE) {
DLOG((DLOG_CLEAN, "lfs_segclean: not cleaning segment %lu:"
" segment is active\n", segnum));
brelse(bp);
return (EBUSY);
}
if (!(sup->su_flags & SEGUSE_DIRTY)) {
DLOG((DLOG_CLEAN, "lfs_segclean: not cleaning segment %lu:"
" segment is already clean\n", segnum));
brelse(bp);
return (EALREADY);
}
@ -929,6 +933,8 @@ lfs_do_segclean(struct lfs *fs, unsigned long segnum)
(void) LFS_BWRITE_LOG(bp);
wakeup(&fs->lfs_avail);
++lfs_stats.segs_reclaimed;
return (0);
}
@ -945,7 +951,7 @@ lfs_segwait(fsid_t *fsidp, struct timeval *tv)
u_long timeout;
int error, s;
if ((mntp = vfs_getvfs(fsidp)) == NULL)
if (fsidp == NULL || (mntp = vfs_getvfs(fsidp)) == NULL)
addr = &lfs_allclean_wakeup;
else
addr = &VFSTOUFS(mntp)->um_lfs->lfs_nextseg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.179 2005/05/20 19:03:11 perseant Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.180 2005/05/20 19:48:25 perseant Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.179 2005/05/20 19:03:11 perseant Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.180 2005/05/20 19:48:25 perseant Exp $");
#if defined(_KERNEL_OPT)
#include "opt_quota.h"
@ -1796,6 +1796,7 @@ SYSCTL_SETUP(sysctl_vfs_lfs_setup, "sysctl vfs.lfs subtree setup")
{ "vflush_invoked", "Number of time vflush was called" },
{ "clean_inlocked", "Number of vnodes skipped for VXLOCK" },
{ "clean_vnlocked", "Number of vnodes skipped for vget failure" },
{ "segs_reclaimed", "Number of segments reclaimed" },
};
sysctl_createv(clog, 0, NULL, NULL,