From owner-freebsd-bugs Thu May 10 3:50:19 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C523737B423 for ; Thu, 10 May 2001 03:50:08 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4AAo8t67695; Thu, 10 May 2001 03:50:08 -0700 (PDT) (envelope-from gnats) Date: Thu, 10 May 2001 03:50:08 -0700 (PDT) Message-Id: <200105101050.f4AAo8t67695@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Jan Conrad Subject: Re: kern/27232: On NFSv3 mounted filesystems, stat returns st_blksize=512 Reply-To: Jan Conrad Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/27232; it has been noted by GNATS. From: Jan Conrad To: Bruce Evans Cc: , Subject: Re: kern/27232: On NFSv3 mounted filesystems, stat returns st_blksize=512 Date: Thu, 10 May 2001 12:46:40 +0200 (CEST) On Thu, 10 May 2001, Bruce Evans wrote: > From: Bruce Evans > To: Garrett Wollman > 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 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). My question is: Why not set this to mnt_stat.f_iosize of the mount point? (As ufs does it?) > > > 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. It is *very* bad for userland io. Unfortunately we have only very limited space here so some poor guys have to sit next to our file server! They can tell by the sound when somebody is saving a large file by stdio fwrites!!! It takes *MORE* then ten times than with a larger st_blksize! -Jan > > > 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 > -- Physikalisches Institut der Universitaet Bonn Nussallee 12 D-53115 Bonn GERMANY To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message