Subject: Re: statvfs(2) replacement for statfs(2) patch
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 04/20/2004 08:03:02
On Apr 20,  7:59pm, yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) wrote:
-- Subject: Re: statvfs(2) replacement for statfs(2) patch

| > | > 	- increase the size of the mounted paths
| > | 
| > | how about use strcpy/copyoutstr for them?
| > | 
| > | how do you think about this?
| > | 	http://mail-index.NetBSD.org/tech-kern/2004/04/15/0001.html
| > 
| > I don't know. How slow is statvfs really? What is the performance impact?
| 
| there's a test result on my box.
| - 100baseTX
| - nfsv3
| - everything is on cache.
| 
| with almost plain 2.0C:
| kaeru% for x in 1 2 3 4 5 6 7 8 9 10;do time find .>/dev/null;done
| find . > /dev/null  0.33s user 2.20s system 38% cpu 6.520 total
| find . > /dev/null  0.29s user 2.67s system 34% cpu 8.471 total
| find . > /dev/null  0.28s user 2.24s system 37% cpu 6.689 total
| find . > /dev/null  0.30s user 2.20s system 38% cpu 6.438 total
| find . > /dev/null  0.24s user 2.28s system 38% cpu 6.492 total
| find . > /dev/null  0.21s user 2.30s system 38% cpu 6.477 total
| find . > /dev/null  0.34s user 2.63s system 34% cpu 8.645 total
| find . > /dev/null  0.25s user 2.24s system 38% cpu 6.441 total
| find . > /dev/null  0.33s user 2.20s system 39% cpu 6.481 total
| find . > /dev/null  0.24s user 2.27s system 38% cpu 6.495 total
| 
| with a patched version of nfs_statfs which doesn't issue FSSTAT RPCs:
| kaeru% for x in 1 2 3 4 5 6 7 8 9 10;do time find .>/dev/null;done
| find . > /dev/null  0.30s user 2.40s system 37% cpu 7.187 total
| find . > /dev/null  0.27s user 1.93s system 42% cpu 5.124 total
| find . > /dev/null  0.22s user 2.02s system 43% cpu 5.187 total
| find . > /dev/null  0.38s user 2.28s system 36% cpu 7.297 total
| find . > /dev/null  0.19s user 2.04s system 43% cpu 5.156 total
| find . > /dev/null  0.23s user 1.98s system 43% cpu 5.125 total
| find . > /dev/null  0.25s user 1.99s system 43% cpu 5.162 total
| find . > /dev/null  0.25s user 1.97s system 42% cpu 5.176 total
| find . > /dev/null  0.25s user 1.99s system 43% cpu 5.161 total
| find . > /dev/null  0.35s user 1.87s system 41% cpu 5.348 total
| 
| of course, alternatively, it can be workarounded in nfs client code.
| i don't think it's an ideal way, though.

Well, we can implement:

    statvfs1(const char *, struct statvfs *, int flags);
    fstatvfs1(int, struct statvfs *, int flags);

in the kernel, then write wrappers that pass ST_WAIT for flags in userland
for statvfs() and fstatvfs() in userland:

    int
    fstatvfs(int fd, struct statvfs *st)
    {
	return fstatvfs1(fd, st, ST_WAIT);
    }

and call in opendir()?

    fstatvfs1(fd, st, ST_NOWAIT);


christos