stat() on a file, returns several fields including st_blksize. This is documented as "the 'preferred' block size for efficient filesystem I/O". The value is not used as a unit for other stat() fields, or referred to anywhere else in the POSIX standard.
statvfs() on a file, returns several fields including f_bsize. It also returns f_frsize. f_frsize is the unit for f_blocks, f_bfree, and f_bavail. f_frsize is variously called the "fundamental file system block size", and the "fragment size".
My man pages for statvfs describe f_bsize as the block size of the filesystem. This basically tells me nothing. The introduction already told me that statvfs() returns information about the filesystem as a whole.
What can
f_bsizebe used for? What does the filesystem block size mean, if it is not equal to the "fundamental filesystem block size"?Is
f_bsizethe same thing asst_blksizeon Linux and BSD and/or UNIX? Let's ignore the possibility of a FUSE filesystem contrived with the sole reason of breaking this rule. And the same for NFS servers. I'm also not very concerned thatf_bsizerepresents a filesystem-wide value, which might be overridden for specific files.Am I right to think that unlike
st_blksize, POSIX does not suggest any particular meanings forf_bsize?