From owner-freebsd-bugs Tue Apr 3 12: 0:10 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id ACD1C37B720 for ; Tue, 3 Apr 2001 12:00:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f33J03Q20092; Tue, 3 Apr 2001 12:00:03 -0700 (PDT) (envelope-from gnats) Received: from bg.sics.se (bg.sics.se [193.10.66.124]) by hub.freebsd.org (Postfix) with ESMTP id 394E637B71D for ; Tue, 3 Apr 2001 11:59:20 -0700 (PDT) (envelope-from bg@bg.sics.se) Received: (from bg@localhost) by bg.sics.se (8.11.1/8.11.1) id f33IxKm19862; Tue, 3 Apr 2001 20:59:20 +0200 (CEST) (envelope-from bg) Message-Id: <200104031859.f33IxKm19862@bg.sics.se> Date: Tue, 3 Apr 2001 20:59:20 +0200 (CEST) From: bg@sics.se Reply-To: bg@sics.se To: FreeBSD-gnats-submit@freebsd.org Cc: bg@sics.se X-Send-Pr-Version: 3.2 Subject: kern/26324: Slow NFS TCP mounts Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 26324 >Category: kern >Synopsis: Defaults for NFS mounts over TCP are slow >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Apr 03 12:00:03 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Bjoern Groenvall >Release: FreeBSD 4.2-RELEASE i386 >Organization: SICS >Environment: FreeBSD NFS clients. >Description: Defaults for NFSv3 mounts over TCP limits rsize and wsize to 8kbytes. This is unnecessarily conservative and leads to slow NFS read/write performance. NFSv3 has a mechanism to negotiate these parameters so there is no danger in increasing the defaults to something more appropiate (e.g sun defaults to 32kbytes). >How-To-Repeat: >Fix: The following patch increases NFS read and write performance between two FreeBSD machines to ~80Mbytes/s. This was measured over an idle 100Mbit/s network. Patch was tested on a FreeBSD 4.2-RELEASE machine. --- /sys/nfs/nfs_vfsops.c.ORIG Sun Sep 10 03:45:36 2000 +++ /sys/nfs/nfs_vfsops.c Mon Apr 2 14:13:35 2001 @@ -841,7 +841,6 @@ register struct nfsmount *nmp; struct nfsnode *np; int error; - struct vattr attrs; if (mp->mnt_flag & MNT_UPDATE) { nmp = VFSTONFS(mp); @@ -883,8 +882,17 @@ nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; - nmp->nm_wsize = NFS_WSIZE; - nmp->nm_rsize = NFS_RSIZE; + if (argp->flags & NFSMNT_NFSV3) { + if (argp->sotype == SOCK_STREAM) { + nmp->nm_wsize = nmp->nm_rsize = NFS_MAXDATA; + } else { + nmp->nm_wsize = NFS_WSIZE; + nmp->nm_rsize = NFS_RSIZE; + } + } else { + nmp->nm_wsize = NFS_WSIZE; + nmp->nm_rsize = NFS_RSIZE; + } nmp->nm_readdirsize = NFS_READDIRSIZE; nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_readahead = NFS_DEFRAHEAD; @@ -932,10 +940,15 @@ *vpp = NFSTOV(np); /* - * Get file attributes for the mountpoint. This has the side - * effect of filling in (*vpp)->v_type with the correct value. + * Retrieval of mountpoint attributes is delayed until nfs_root + * or nfs_statfs are first called. This will happen either when + * we first traverse the mount point or if somebody does a df. + * + * NFSSTA_GOTFSINFO is used to flag if we have succesfully + * retreived mountpoint attributes. In the case of NFSv3 we + * also flag static fsinfo. */ - VOP_GETATTR(*vpp, &attrs, curproc->p_ucred, curproc); + (*vpp)->v_type = VNON; /* * Lose the lock but keep the ref. @@ -1042,6 +1055,20 @@ if (error) return (error); vp = NFSTOV(np); + /* + * Get transfer parameters and root vnode attributes. + */ + if ((nmp->nm_state & NFSSTA_GOTFSINFO) == 0) { + if (nmp->nm_flag & NFSMNT_NFSV3) { + nfs_fsinfo(nmp, vp, curproc->p_ucred, curproc); + mp->mnt_stat.f_iosize = nfs_iosize(nmp); + } else { + struct vattr attrs; + error = VOP_GETATTR(vp, &attrs, curproc->p_ucred, curproc); + if (!error) + nmp->nm_state |= NFSSTA_GOTFSINFO; + } + } if (vp->v_type == VNON) vp->v_type = VDIR; vp->v_flag = VROOT; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message