Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 May 2001 10:11:55 -0700 (PDT)
From:      conrad@th.physik.uni-bonn.de
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/27232: On NFSv3 mounted filesystems, stat returns st_blksize=512
Message-ID:  <200105091711.f49HBtp13241@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         27232
>Category:       kern
>Synopsis:       On NFSv3 mounted filesystems, stat returns st_blksize=512
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 09 10:20:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jan Conrad
>Release:        FreeBSD 4.3R
>Organization:
Univ. Bonn, Germany
>Environment:
FreeBSD merlin.th.physik.uni-bonn.de 4.3-RELEASE FreeBSD 4.3-RELEASE #0: Mon May  7 14:08:48 CEST 2001     conrad@merlin.th.physik.uni-bonn.de:/freebsd/misc/src/sys/compile/DEBUG  i386

>Description:
On NFSv3 mounts, stat returns st_blksize=512 for every regular file.
This in turn is used by libc routines as a default buffer size, as it
should be the 'optimal' io blocksize.

However, this leads to a drastic performance decrease. For example
a mailbox save of a 3MB messages (by pine) takes over half a minute
with 512 byte writes whereas it takes only a second or so with a 16kB
buffer.

>How-To-Repeat:
See above.

>Fix:
The whole thing can be traced back to the NFS code in the kernel.
The function nfs_loadattrcache of sys/nfs/nfs_subs.c makes the
assignement

		vap->va_blocksize = NFS_FABLKSIZE;

for NFSv3, where NFS_FABLKSIZE is 512.

In my opinion the assignement should be something like

		vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;

i.e. va_blocksize should be assigned the 'optimal' iosize for the
mounted file system. I think that this is the maximum of the read
and write blocksize of the nfs-mount (search for nfs_iosize in
nfs_vfsops.c).

This should solve the problem, but I am no kernel hacker :-)
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105091711.f49HBtp13241>