Date: Thu, 10 May 2001 01:30:02 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/27232: On NFSv3 mounted filesystems, stat returns st_blksize=512 Message-ID: <200105100830.f4A8U2g49429@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/27232; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: kern/27232: On NFSv3 mounted filesystems, stat returns st_blksize=512 Date: Thu, 10 May 2001 18:24:04 +1000 (EST) On Wed, 9 May 2001, Garrett Wollman wrote: > <<On Wed, 9 May 2001 10:11:55 -0700 (PDT), conrad@th.physik.uni-bonn.de said: > > > 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. > > No. It should be the block size used by the underlying filesystem's > block allocator, Correct. Even if there is no underlying filesystem's block allocator, stat() must fake it, and should fake it as well as possible. nfs seems to have regressed to always setting vap->va_blocksize to NFS_FABLKSIZE (512) in the v3 case (see nfs_subs.c). > and in which the file's `st_blocks' size-on-disk is > reportedi. No. At least under FreeBSD, st_blocks is in units of blocks with size S_BLKSIZE (512). It may count blocks for metadata, so it may be larger than the file size. > While SUS describes it as a ``preferred'' block size, and > the FreeBSD manual pages describe it as ``optimal ... for I/O'', the It is just the best available approximation to the optimal i/o size. If it is good enough for filesystem blocks, then it can't be very bad for userland i/o. > most important meaning of this field is as a multiplier of st_blocks > to determine the file's size. No. The multiplier is 512. Bruce 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?200105100830.f4A8U2g49429>