🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #8770

Re: NFS V3 problem with readdir(3C)

#8770
From: Tim Thompson
Date: Tue, 25 Jun 1996 00:00
85 lines
3223 bytes
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).
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
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
    

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:

	$ ./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?

					Tim Thompson
					tgt@lucent.com

FILE: with_stat.c
==================================================================
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
 
main(argc,argv)
int argc;
char *argv[];
{
    register struct dirent      *ep;
    register DIR        *dp;
    long now;
    register struct stat        *statbuf;
 
    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);
 
    now = time(0);
    printf("END TIME: %s\n", ctime(&now));
}
==================================================================

The file without_stat.c is exactly the same, except the stat() line
is replaced by a single semi-colon.
-- 
This is an all-natural posting, containing | Tim Thompson
no artificial colorings, flavorings, or    | Netnews Service Manager/Engineer
preservatives.                             | Lucent Technologies
                                           | tgt@lucent.com

Technical Details
Message-ID: <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
References: <4qmr2b$64s@nntpa.cb.lucent.com> <4qn5r9$3hb@engnews2.eng.sun.com>

Show Full Headers
Complete Article Headers
Message-ID: <4qoq8q$9f0@nntpa.cb.lucent.com>
Subject: Re: NFS V3 problem with readdir(3C)
Date: Tue, 25 Jun 1996 00:00:00 +0000
From: tgt@pongo.cb.att.com (Tim Thompson)
References: <4qmr2b$64s@nntpa.cb.lucent.com> <4qn5r9$3hb@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-mail
X-Deja-AN: 162068518
Distribution: inet
Organization: AT&T Bell Labs, Columbus, Ohio
Newsgroups: comp.unix.solaris,news.software.nntp