diff options
author | dillon <dillon@FreeBSD.org> | 2002-12-28 20:28:10 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2002-12-28 20:28:10 +0000 |
commit | 4ecb4d83e44022a7cb2e3df7eb4430794d31afdd (patch) | |
tree | 095dcb0d1beff9fe8e8cfa8605299973e1abf296 /sys | |
parent | c538ab97f263bf99c70e52af35914192bce83ff2 (diff) | |
download | FreeBSD-src-4ecb4d83e44022a7cb2e3df7eb4430794d31afdd.zip FreeBSD-src-4ecb4d83e44022a7cb2e3df7eb4430794d31afdd.tar.gz |
Abstract-out the constants for the sequential heuristic.
No operational changes.
MFC after: 1 day
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_vnops.c | 6 | ||||
-rw-r--r-- | sys/nfsserver/nfs_serv.c | 6 | ||||
-rw-r--r-- | sys/sys/vnode.h | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 01afcd9..a801728 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -340,9 +340,9 @@ sequential_heuristic(struct uio *uio, struct file *fp) * are. */ fp->f_seqcount += (uio->uio_resid + BKVASIZE - 1) / BKVASIZE; - if (fp->f_seqcount >= 127) - fp->f_seqcount = 127; - return(fp->f_seqcount << 16); + if (fp->f_seqcount > IO_SEQMAX) + fp->f_seqcount = IO_SEQMAX; + return(fp->f_seqcount << IO_SEQSHIFT); } /* diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index 97936d1..19fc992 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -861,8 +861,8 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, */ if ((off == 0 && nh->nh_seqcount > 0) || off == nh->nh_nextr) { - if (++nh->nh_seqcount > 127) - nh->nh_seqcount = 127; + if (++nh->nh_seqcount > IO_SEQMAX) + nh->nh_seqcount = IO_SEQMAX; } else if (nh->nh_seqcount > 1) { nh->nh_seqcount = 1; } else { @@ -871,7 +871,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, nh->nh_use += NHUSE_INC; if (nh->nh_use > NHUSE_MAX) nh->nh_use = NHUSE_MAX; - ioflag |= nh->nh_seqcount << 16; + ioflag |= nh->nh_seqcount << IO_SEQSHIFT; } nfsm_reply(NFSX_POSTOPORFATTR(v3) + 3 * NFSX_UNSIGNED+nfsm_rndup(cnt)); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 44af2bc..fd7e6c4 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -281,6 +281,9 @@ struct vattr { #define IO_NORMAL 0x0800 /* operate on regular data */ #define IO_NOMACCHECK 0x1000 /* MAC checks unnecessary */ +#define IO_SEQMAX 0x7F /* seq heuristic max value */ +#define IO_SEQSHIFT 16 /* seq heuristic in upper 16 bits */ + /* * Modes. Some values same as Ixxx entries from inode.h for now. */ |