QIO_BUFFERSIZE

Russ Allbery eagle at eyrie.org
Mon Dec 7 17:44:09 UTC 2020


Bo Lindbergh <2bfjdsla52kztwejndzdstsxl9athp at gmail.com> writes:
> Quoth Russ Allbery <eagle at eyrie.org>:

>> This is supposed to only be a fallback, and the actual buffer size is
>> determined based on st_blksize of the fstat data structure for a file
>> (which, at least on the ext3 system I'm currently looking at, is 4KB
>> and thus even smaller).  That means that changing this require more
>> than just changing that #define, so I'm moderately surprised that
>> changing the #define did anything on your system.  That implies to me
>> that either st_blksize isn't working on your system or something else
>> weird is going on.  What operating system and underlying file system is
>> this?

> It works because the buffer_size function never returns a value smaller
> than QIO_BUFFERSIZE.

Oh, I see now.  Wow, I didn't write that code in a very straightforward
way and didn't do myself any favors with the comment.

> On both Linux and macOS I'm getting st_blksize == 4096 everywhere except
> for a 56 GB exFAT partition on an external disk, where it's 131072.  It
> seems filesystem code writers have repurposed st_blksize to mean the
> allocation block size.

Yeah, I think the probe that code is doing is mostly meaningless and
there's no downside to always using a predictable, larger buffer.

-- 
Russ Allbery (eagle at eyrie.org)             <https://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <https://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list