Use a consistent blocksize for sizing bufs to avoid panicing the bio system.

This commit is contained in:
Doug Rabson 1995-07-07 11:01:31 +00:00
parent a3f8d23a48
commit 05085e65f6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9428
4 changed files with 46 additions and 14 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94
* $Id: nfs_bio.c,v 1.14 1995/05/30 08:12:35 rgrimes Exp $
* $Id: nfs_bio.c,v 1.15 1995/06/27 11:06:34 dfr Exp $
*/
#include <sys/param.h>
@ -107,7 +107,7 @@ nfs_bioread(vp, uio, ioflag, cred)
p = uio->uio_procp;
if ((nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_GOTFSINFO)) == NFSMNT_NFSV3)
(void)nfs_fsinfo(nmp, vp, cred, p);
biosize = nmp->nm_rsize;
biosize = vp->v_mount->mnt_stat.f_iosize;
/*
* For nfs, cache consistency can only be maintained approximately.
* Although RFC1094 does not specify the criteria, the following is
@ -464,7 +464,7 @@ nfs_write(ap)
* will be the same size within a filesystem. nfs_writerpc will
* still use nm_wsize when sizing the rpc's.
*/
biosize = nmp->nm_rsize;
biosize = vp->v_mount->mnt_stat.f_iosize;
do {
/*
@ -619,7 +619,7 @@ nfs_getcacheblk(vp, bn, size, p)
{
register struct buf *bp;
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
int biosize = nmp->nm_rsize;
int biosize = vp->v_mount->mnt_stat.f_iosize;
if (nmp->nm_flag & NFSMNT_INT) {
bp = getblk(vp, bn, size, PCATCH, 0);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_vfsops.c,v 1.15 1995/06/11 19:31:46 rgrimes Exp $
* $Id: nfs_vfsops.c,v 1.16 1995/06/27 11:06:51 dfr Exp $
*/
#include <sys/param.h>
@ -112,6 +112,22 @@ void nfsargs_ntoh __P((struct nfs_args *));
static struct mount *nfs_mountdiskless __P((char *, char *, int,
struct sockaddr_in *, struct nfs_args *, register struct vnode **));
static int nfs_iosize(nmp)
struct nfsmount* nmp;
{
int iosize;
/*
* Calculate the size used for io buffers. Use the larger
* of the two sizes to minimise nfs requests but make sure
* that it is at least one VM page to avoid wasting buffer
* space.
*/
iosize = max(nmp->nm_rsize, nmp->nm_wsize);
if (iosize < NBPG) iosize = NBPG;
return iosize;
}
/*
* nfs statfs call
*/
@ -163,7 +179,7 @@ nfs_statfs(mp, sbp, p)
sbp->f_type = MOUNT_NFS;
#endif
sbp->f_flags = nmp->nm_flag;
sbp->f_iosize = min(nmp->nm_rsize, nmp->nm_wsize);
sbp->f_iosize = nfs_iosize(nmp);
if (v3) {
sbp->f_bsize = NFS_FABLKSIZE;
fxdr_hyper(&sfp->sf_tbytes, &tquad);
@ -662,7 +678,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
* stuck on a dead server and we are holding a lock on the mount
* point.
*/
mp->mnt_stat.f_iosize = min(nmp->nm_rsize, nmp->nm_wsize);
mp->mnt_stat.f_iosize = nfs_iosize(nmp);
/*
* A reference count is needed on the nfsnode representing the
* remote root. If this object is not persistent, then backward

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_bio.c 8.5 (Berkeley) 1/4/94
* $Id: nfs_bio.c,v 1.14 1995/05/30 08:12:35 rgrimes Exp $
* $Id: nfs_bio.c,v 1.15 1995/06/27 11:06:34 dfr Exp $
*/
#include <sys/param.h>
@ -107,7 +107,7 @@ nfs_bioread(vp, uio, ioflag, cred)
p = uio->uio_procp;
if ((nmp->nm_flag & (NFSMNT_NFSV3 | NFSMNT_GOTFSINFO)) == NFSMNT_NFSV3)
(void)nfs_fsinfo(nmp, vp, cred, p);
biosize = nmp->nm_rsize;
biosize = vp->v_mount->mnt_stat.f_iosize;
/*
* For nfs, cache consistency can only be maintained approximately.
* Although RFC1094 does not specify the criteria, the following is
@ -464,7 +464,7 @@ nfs_write(ap)
* will be the same size within a filesystem. nfs_writerpc will
* still use nm_wsize when sizing the rpc's.
*/
biosize = nmp->nm_rsize;
biosize = vp->v_mount->mnt_stat.f_iosize;
do {
/*
@ -619,7 +619,7 @@ nfs_getcacheblk(vp, bn, size, p)
{
register struct buf *bp;
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
int biosize = nmp->nm_rsize;
int biosize = vp->v_mount->mnt_stat.f_iosize;
if (nmp->nm_flag & NFSMNT_INT) {
bp = getblk(vp, bn, size, PCATCH, 0);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.3 (Berkeley) 1/4/94
* $Id: nfs_vfsops.c,v 1.15 1995/06/11 19:31:46 rgrimes Exp $
* $Id: nfs_vfsops.c,v 1.16 1995/06/27 11:06:51 dfr Exp $
*/
#include <sys/param.h>
@ -112,6 +112,22 @@ void nfsargs_ntoh __P((struct nfs_args *));
static struct mount *nfs_mountdiskless __P((char *, char *, int,
struct sockaddr_in *, struct nfs_args *, register struct vnode **));
static int nfs_iosize(nmp)
struct nfsmount* nmp;
{
int iosize;
/*
* Calculate the size used for io buffers. Use the larger
* of the two sizes to minimise nfs requests but make sure
* that it is at least one VM page to avoid wasting buffer
* space.
*/
iosize = max(nmp->nm_rsize, nmp->nm_wsize);
if (iosize < NBPG) iosize = NBPG;
return iosize;
}
/*
* nfs statfs call
*/
@ -163,7 +179,7 @@ nfs_statfs(mp, sbp, p)
sbp->f_type = MOUNT_NFS;
#endif
sbp->f_flags = nmp->nm_flag;
sbp->f_iosize = min(nmp->nm_rsize, nmp->nm_wsize);
sbp->f_iosize = nfs_iosize(nmp);
if (v3) {
sbp->f_bsize = NFS_FABLKSIZE;
fxdr_hyper(&sfp->sf_tbytes, &tquad);
@ -662,7 +678,7 @@ mountnfs(argp, mp, nam, pth, hst, vpp)
* stuck on a dead server and we are holding a lock on the mount
* point.
*/
mp->mnt_stat.f_iosize = min(nmp->nm_rsize, nmp->nm_wsize);
mp->mnt_stat.f_iosize = nfs_iosize(nmp);
/*
* A reference count is needed on the nfsnode representing the
* remote root. If this object is not persistent, then backward