vfs: incomplete pass at converting more ints to u_long

Most notably numvnodes and freevnodes were u_long, but parameters used to
govern them remained as ints.
This commit is contained in:
mjg 2020-01-11 22:56:20 +00:00
parent e21b9aa538
commit 85edb793f6
4 changed files with 17 additions and 16 deletions

View File

@ -1979,13 +1979,13 @@ nchinit(void *dummy __unused)
SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_SECOND, nchinit, NULL);
void
cache_changesize(int newmaxvnodes)
cache_changesize(u_long newmaxvnodes)
{
struct nchashhead *new_nchashtbl, *old_nchashtbl;
u_long new_nchash, old_nchash;
struct namecache *ncp;
uint32_t hash;
int newncsize;
u_long newncsize;
int i;
newncsize = newmaxvnodes * ncsizefactor;

View File

@ -199,7 +199,7 @@ vfs_hash_rehash(struct vnode *vp, u_int hash)
}
void
vfs_hash_changesize(int newmaxvnodes)
vfs_hash_changesize(u_long newmaxvnodes)
{
struct vfs_hash_head *vfs_hash_newtbl, *vfs_hash_oldtbl;
u_long vfs_hash_newmask, vfs_hash_oldmask;

View File

@ -310,20 +310,21 @@ static enum { SYNCER_RUNNING, SYNCER_SHUTTING_DOWN, SYNCER_FINAL_DELAY }
syncer_state;
/* Target for maximum number of vnodes. */
int desiredvnodes;
static int gapvnodes; /* gap between wanted and desired */
static int vhiwat; /* enough extras after expansion */
static int vlowat; /* minimal extras before expansion */
static int vstir; /* nonzero to stir non-free vnodes */
u_long desiredvnodes;
static u_long gapvnodes; /* gap between wanted and desired */
static u_long vhiwat; /* enough extras after expansion */
static u_long vlowat; /* minimal extras before expansion */
static u_long vstir; /* nonzero to stir non-free vnodes */
static volatile int vsmalltrigger = 8; /* pref to keep if > this many pages */
static int
sysctl_update_desiredvnodes(SYSCTL_HANDLER_ARGS)
{
int error, old_desiredvnodes;
u_long old_desiredvnodes;
int error;
old_desiredvnodes = desiredvnodes;
if ((error = sysctl_handle_int(oidp, arg1, arg2, req)) != 0)
if ((error = sysctl_handle_long(oidp, arg1, arg2, req)) != 0)
return (error);
if (old_desiredvnodes != desiredvnodes) {
wantfreevnodes = desiredvnodes / 4;
@ -336,7 +337,7 @@ sysctl_update_desiredvnodes(SYSCTL_HANDLER_ARGS)
SYSCTL_PROC(_kern, KERN_MAXVNODES, maxvnodes,
CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, &desiredvnodes, 0,
sysctl_update_desiredvnodes, "I", "Target for maximum number of vnodes");
sysctl_update_desiredvnodes, "UL", "Target for maximum number of vnodes");
SYSCTL_ULONG(_kern, OID_AUTO, minvnodes, CTLFLAG_RW,
&wantfreevnodes, 0, "Old name for vfs.wantfreevnodes (legacy)");
static int vnlru_nowhere;
@ -459,7 +460,7 @@ PCTRIE_DEFINE(BUF, buf, b_lblkno, buf_trie_alloc, buf_trie_free);
* grows, the ratio of the memory size in KB to vnodes approaches 64:1.
*/
#ifndef MAXVNODES_MAX
#define MAXVNODES_MAX (512 * 1024 * 1024 / 64) /* 8M */
#define MAXVNODES_MAX (512UL * 1024 * 1024 / 64) /* 8M */
#endif
static MALLOC_DEFINE(M_VNODE_MARKER, "vnodemarker", "vnode marker");
@ -582,7 +583,7 @@ vntblinit(void *dummy __unused)
desiredvnodes = min(physvnodes, virtvnodes);
if (desiredvnodes > MAXVNODES_MAX) {
if (bootverbose)
printf("Reducing kern.maxvnodes %d -> %d\n",
printf("Reducing kern.maxvnodes %lu -> %lu\n",
desiredvnodes, MAXVNODES_MAX);
desiredvnodes = MAXVNODES_MAX;
}

View File

@ -434,7 +434,7 @@ extern int vttoif_tab[];
*/
extern struct vnode *rootvnode; /* root (i.e. "/") vnode */
extern struct mount *rootdevmp; /* "/dev" mount */
extern int desiredvnodes; /* number of vnodes desired */
extern u_long desiredvnodes; /* number of vnodes desired */
extern struct uma_zone *namei_zone;
extern struct vattr va_null; /* predefined null vattr structure */
@ -607,7 +607,7 @@ typedef int (*vn_get_ino_t)(struct mount *, void *, int, struct vnode **);
int bnoreuselist(struct bufv *bufv, struct bufobj *bo, daddr_t startn,
daddr_t endn);
/* cache_* may belong in namei.h. */
void cache_changesize(int newhashsize);
void cache_changesize(u_long newhashsize);
#define cache_enter(dvp, vp, cnp) \
cache_enter_time(dvp, vp, cnp, NULL, NULL)
void cache_enter_time(struct vnode *dvp, struct vnode *vp,
@ -924,7 +924,7 @@ int fifo_printinfo(struct vnode *);
/* vfs_hash.c */
typedef int vfs_hash_cmp_t(struct vnode *vp, void *arg);
void vfs_hash_changesize(int newhashsize);
void vfs_hash_changesize(u_long newhashsize);
int vfs_hash_get(const struct mount *mp, u_int hash, int flags,
struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
u_int vfs_hash_index(struct vnode *vp);