Date: Fri, 17 Jul 2009 15:30:43 -0400 (EDT) From: Rick Macklem <rmacklem@uoguelph.ca> To: Anonymous <swell.k@gmail.com> Cc: freebsd-current@freebsd.org Subject: Re: [newnfs/client] -alldirs: listing files consumes too much memory Message-ID: <Pine.GSO.4.63.0907171525200.3849@muncher.cs.uoguelph.ca> In-Reply-To: <861vogcyp4.fsf@gmail.com> References: <861vogcyp4.fsf@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 16 Jul 2009, Anonymous wrote: > Let's create 335 empty files in /blah and try to list them over nfsv3. > > # uname -vm > FreeBSD 8.0-BETA1 #0: Sat Jul 4 03:55:14 UTC 2009 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 > > # mkdir /blah > # (while [ $((i+=1)) -le 334 ]; do : >/blah/foo_$i; done) > # echo / -alldirs >/etc/exports > # /etc/rc.d/nfsd onestart > # mount -t newnfs -o nfsv3 0:/blah /mnt > Ok, I figured it out. I wasn't setting mp->mnt_stat.f_iosize before getting the root vnode and, as such, getnewvnode() was setting bo_bsize = 0. That confused getblk(), so it would always end up returning block0, since it uses bo_bsize for a block calc. The patch follows, in case you're interested in testing it. (I'll be queuing this patch up with re@ once I've tested it some more.) Thanks again for pointing the problem out, rick -- patch for exp. nfs client -- --- fs/nfsclient/nfs_clvfsops.c.sav 2009-07-17 12:18:42.000000000 -0400 +++ fs/nfsclient/nfs_clvfsops.c 2009-07-17 15:09:41.000000000 -0400 @@ -1194,6 +1194,12 @@ } } if (nmp->nm_fhsize > 0) { + /* + * Set f_iosize to NFS_DIRBLKSIZ so that bo_bsize gets set + * non-zero for the root vnode. f_iosize will be set correctly + * by nfs_statfs() before any I/O occurs. + */ + mp->mnt_stat.f_iosize = NFS_DIRBLKSIZ; error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np); if (error) goto bad;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.63.0907171525200.3849>