diff options
-rw-r--r-- | sys/ufs/ffs/ffs_extern.h | 10 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 14 | ||||
-rw-r--r-- | sys/ufs/ufs/dirhash.h | 3 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_dirhash.c | 13 |
4 files changed, 34 insertions, 6 deletions
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 1652ea0eba6..1eb46553dad 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_extern.h,v 1.21 2003/06/02 23:28:23 millert Exp $ */ +/* $OpenBSD: ffs_extern.h,v 1.22 2004/01/07 20:47:47 tedu Exp $ */ /* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */ /*- @@ -48,7 +48,10 @@ #define FFS_SD_INODE_BITMAP 14 /* bufs redirtied as inode bitmap not written */ #define FFS_SD_DIRECT_BLK_PTRS 15 /* bufs redirtied as direct ptrs not written */ #define FFS_SD_DIR_ENTRY 16 /* bufs redirtied as dir entry cannot write */ -#define FFS_MAXID 17 /* number of valid ffs ids */ +#define FFS_DIRHASH_DIRSIZE 17 /* min directory size, in bytes */ +#define FFS_DIRHASH_MAXMEM 18 /* max kvm to use, in bytes */ +#define FFS_DIRHASH_MEM 19 /* current mem usage, in bytes */ +#define FFS_MAXID 20 /* number of valid ffs ids */ #define FFS_NAMES { \ { 0, 0 }, \ @@ -68,6 +71,9 @@ { "sd_inode_bitmap", CTLTYPE_INT }, \ { "sd_direct_blk_ptrs", CTLTYPE_INT }, \ { "sd_dir_entry", CTLTYPE_INT }, \ + { "dirhash_dirsize", CTLTYPE_INT }, \ + { "dirhash_maxmem", CTLTYPE_INT }, \ + { "dirhash_mem", CTLTYPE_INT }, \ } diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 4d0e448eba8..58cf64d7c6b 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.61 2003/10/17 15:08:11 mpech Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.62 2004/01/07 20:47:47 tedu Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -60,6 +60,7 @@ #include <ufs/ufs/inode.h> #include <ufs/ufs/dir.h> #include <ufs/ufs/ufs_extern.h> +#include <ufs/ufs/dirhash.h> #include <ufs/ffs/fs.h> #include <ufs/ffs/ffs_extern.h> @@ -1440,6 +1441,17 @@ ffs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) case FFS_SD_DIR_ENTRY: return (sysctl_rdint(oldp, oldlenp, newp, stat_dir_entry)); #endif +#ifdef UFS_DIRHASH + case FFS_DIRHASH_DIRSIZE: + return (sysctl_int(oldp, oldlenp, newp, newlen, + &ufs_mindirhashsize)); + case FFS_DIRHASH_MAXMEM: + return (sysctl_int(oldp, oldlenp, newp, newlen, + &ufs_dirhashmaxmem)); + case FFS_DIRHASH_MEM: + return (sysctl_rdint(oldp, oldlenp, newp, ufs_dirhashmem)); +#endif + default: return (EOPNOTSUPP); } diff --git a/sys/ufs/ufs/dirhash.h b/sys/ufs/ufs/dirhash.h index ac922601de3..48a931642c5 100644 --- a/sys/ufs/ufs/dirhash.h +++ b/sys/ufs/ufs/dirhash.h @@ -106,6 +106,9 @@ struct dirhash { TAILQ_ENTRY(dirhash) dh_list; /* chain of all dirhashes */ }; +extern int ufs_mindirhashsize; +extern int ufs_dirhashmaxmem; +extern int ufs_dirhashmem; /* * Dirhash functions. diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index a759389abf7..bbd0da2b189 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -54,10 +54,10 @@ #define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0) #define BLKFREE2IDX(n) ((n) > DH_NFSTATS ? DH_NFSTATS : (n)) -int ufs_mindirhashsize = DIRBLKSIZ * 5; -int ufs_dirhashmaxmem = 2 * 1024 * 1024; +int ufs_mindirhashsize; +int ufs_dirhashmaxmem; int ufs_dirhashmem; -int ufs_dirhashcheck = 0; +int ufs_dirhashcheck; int ufsdirhash_hash(struct dirhash *dh, char *name, int namelen); @@ -1056,6 +1056,13 @@ ufsdirhash_init() "dirhash", &pool_allocator_nointr); rw_init(&ufsdirhash_mtx); TAILQ_INIT(&ufsdirhash_list); +#if defined (__sparc__) + if (!CPU_ISSUN4OR4C) +#elif defined (__vax__) + if (0) +#endif + ufs_dirhashmaxmem = 2 * 1024 * 1024; + ufs_mindirhashsize = 5 * DIRBLKSIZ; } void |