diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index f9ae8b6fd00f..85077838bb17 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -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 @@ -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); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 2c4070b7e8ca..df3fea517e9e 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -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 @@ -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 diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index f9ae8b6fd00f..85077838bb17 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -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 @@ -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); diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 2c4070b7e8ca..df3fea517e9e 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -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 @@ -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