Increase BUFSIZ to 8192

Poul-Henning Kamp phk at phk.freebsd.dk
Thu May 14 15:29:47 UTC 2015


--------
In message <5554B8D6.1010705 at mu.org>, Alfred Perlstein writes:

>Shouldn't most of these be using st.st_blksize ?

We had a long discussion about that back when GEOM was young and the
conclusionis that st_blksize doesn't tell you anything useful
and generally does the wrong thing, in particular on non-native
filesystems like msdosfs and cd9660.

But the world is more complex than even that.

For instance on a RAID-5 volume, you want to write stripe-width
chunks, properly aligned, no matter what the st_blksize might be
in your filesystem.  Unless your filesystem is guaranteed to lay
out sequentially, you would have to ask before each write.

Other filesystems may have opinions about read-sizes (ie: NFS).

The only sane way to do this properly would be to ask each
individual file with fcntl(2) for preferred read or write
sizes.

You could then have embedded system mount filesystems with
	-o iosize=min
and servers instead use
	-o iosize=fastest

But for most practical purposes, having a sane constant BUFSIZ is
just fine.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-current mailing list