Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!wuarchive!uunet!mcsun!ukc!edcastle!aiai!richard From: richard@aiai.ed.ac.uk (Richard Tobin) Newsgroups: comp.unix.wizards Subject: Re: What, exactly, are stat.st_blocks, statfs.f_bsize? Message-ID: <4305@skye.ed.ac.uk> Date: 12 Mar 91 13:37:39 GMT References: <147432@pyramid.pyramid.com> <6558@auspex.auspex.com> Reply-To: richard@aiai.UUCP (Richard Tobin) Organization: AIAI, University of Edinburgh, Scotland Lines: 37 In article <6558@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: >>There is nothing in the NFS protocol that specifies a required filesystem >>or directory block size. >It also doesn't specify the units to be used in the "blocks" field of >the "fattr" structure in an NFS GETATTR reply; this is extremely >unfortunate, Particularly given that it appears to specify it; the obvious interpretation of the protocol specification is that it's in units of "blocksize": "'blocksize' is the size in bytes of a block of the file ... 'blocks' is the number of blocks the file takes up on disk" [NFS: Version 2 Protocol Specification, reproduced in the SunOS 4.1 documentation] It would take a mind-reader to guess that the two uses of "block" in one sentence had different meanings, and that the first use in fact meant "the optimal transfer size". >Given that most (modern UNIX) clients probably just use what they get >back from the server in the "blocks" field, the most appropriate >convention would probably be to say "'blocks' is in units of 512-byte >chunks, regardless of what the block or fragment size of the underlying >file system, or the disk block size, is." This does seem the best solution. Fortunately, disk block sizes are usually a multiple of 512 bytes, so the space occupied can be reported accurately. -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin