Article View: news.software.nntp
Article #8780Re: NFS V3 problem with readdir(3C)
From: Michael R. Eisler
Date: Tue, 25 Jun 1996 00:00
Date: Tue, 25 Jun 1996 00:00
121 lines
4339 bytes
4339 bytes
In article <4qoq8q$9f0@nntpa.cb.lucent.com>,
Tim Thompson <tgt@pongo.cb.att.com> wrote:
>In article <4qn5r9$3hb@engnews2.eng.sun.com>,
>Michael R. Eisler <mre@eng.sun.com> wrote:
>>
>>Solaris 2.5 clients use the NFS3_READDIRPLUS procedure which will also return
>>attributes withe each directory entry. Programs like find, ls -l,
>>etc. are supposed to be faster. It would be itneresting to seehow your
>>test program performans if you stat() each entry in the directory.
>
>I just did this, and still got similar results (program included below).
Your new program has a flaw, unless your current working directory is
equal to the directory your are opening. The stat()'s will all return
errors as you've currently written your program. You need a chdir(argv[1])
before you start readding and stating your dir entries.
>Just to be fair, I've got two versions of the program, one with stat(), and
>one without it. I've used the one that includes stat() on the V2-mounted
>file system, and the one without on the V3 file system. Since NFS3_READDIRPLUS
>is used in NFS V3, there's no point in doing the extra stat(). Observe
But then you are being unfair to NFS V2.
>the results:
>
> $ ./with_stat /V2/alt/test
> START TIME: Tue Jun 25 09:27:05 1996
>
> END TIME: Tue Jun 25 09:27:09 1996
>
> $ ./without_stat /V3/alt/test
> START TIME: Tue Jun 25 09:27:21 1996
>
> END TIME: Tue Jun 25 09:33:28 1996
I'm not seeing these results. I created a directory with 1002 entries.
without stat:
% /tmp/a.out /tmp/mre/V3/tmp/test
START TIME: Tue Jun 25 10:04:46 1996
END TIME: Tue Jun 25 10:04:48 1996
COUNT: 1002
% /tmp/a.out /tmp/mre/V2/tmp/test
START TIME: Tue Jun 25 10:05:12 1996
END TIME: Tue Jun 25 10:05:12 1996
COUNT: 1002
with stat:
% /tmp/a.out /tmp/mre/V2/tmp/test with_stat
START TIME: Tue Jun 25 10:17:00 1996
END TIME: Tue Jun 25 10:17:11 1996
COUNT: 1002
% /tmp/a.out /tmp/mre/V3/tmp/test with_stat
START TIME: Tue Jun 25 10:17:26 1996
END TIME: Tue Jun 25 10:17:28 1996
COUNT: 1002
Between runs of without stat and with stat, I mounted a different
hostname of my multihomed server so tht directory and rnode caches would
be missed with 2nd run. I should have also created two separate
directories on my server so that server caching didn't come into
play. Finally I didn't run this on a private net. Nonethless, I'm not
seeing the disparity in version 2 and Version 3 performance you are.
How big is your test direcotory and how long are the names?
>Another interesting point is if I run the program on the V3-mounted file
>system immediately after the first run, performance is acceptable - it must
>have the file attributes cached on the client:
Attributes and directories are cached.
>
> $ ./without_stat /V3/alt/test
> START TIME: Tue Jun 25 09:36:32 1996
>
> END TIME: Tue Jun 25 09:36:33 1996
>
>
>Is there any way to turn off READDIRPLUS for a V3-mounted file system?
I haven't looked, but I think there is something else going on here that
should be investigated.
> register struct stat *statbuf;
statbuf has to initialized to point to something.
>
> dp = opendir(argv[1]);
>
> if (dp == NULL)
> {
> printf("No such directory!\n");
> exit(-1);
> }
>
>
> now = time(0);
> printf("START TIME: %s\n", ctime(&now));
> while ((ep = readdir(dp)) != NULL)
> stat(ep->d_name, statbuf);
if argv[1] is not equal to ".", then the stat() will fail.
--
-Mike Eisler NFS group
mre@Eng.Sun.Com SunSoft
Technical Details
Message-ID:
<4qp7le$i2v@engnews2.Eng.Sun.COM>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<4qmr2b$64s@nntpa.cb.lucent.com> <4qn5r9$3hb@engnews2.eng.sun.com> <4qoq8q$9f0@nntpa.cb.lucent.com>Show Full Headers
Complete Article Headers
Message-ID: <4qp7le$i2v@engnews2.Eng.Sun.COM> Subject: Re: NFS V3 problem with readdir(3C) Date: Tue, 25 Jun 1996 00:00:00 +0000 From: mre@dfs-10.eng.sun.com (Michael R. Eisler) References: <4qmr2b$64s@nntpa.cb.lucent.com> <4qn5r9$3hb@engnews2.eng.sun.com> <4qoq8q$9f0@nntpa.cb.lucent.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 162105024 Distribution: inet Organization: Sun Microsystems, Inc. Reply-to: mre@eng.sun.com Newsgroups: comp.unix.solaris,news.software.nntp