[squid-dev] [POSSIBLE BUG???] "FS Block Size = 1024" printed by cachemgr.cgi

Alex Rousskov rousskov at measurement-factory.com
Fri Jun 9 05:35:40 UTC 2017


On 06/08/2017 09:36 PM, Stéphane Ouellette wrote:

> Isn't storeDirGetBlkSize() meant to return the "file system block size"?

Naturally, storeDirGetBlkSize() is not meant to return the file system
block size.</sarcasm>

AFAICT, storeDirGetBlkSize() users expect this function to return,
roughly, the disk space occupied by a file containing one byte. That
space is fragment size, not block size (although the two are often the
same).

In other words, the function returns the right value but is misnamed.

In Squid "defense", I have to note that the names of the statvfs(3)
structure fields have a similar problem:

> struct statvfs {
...
>     unsigned long  f_frsize;   /* Fragment size */
>     fsblkcnt_t     f_blocks;   /* Size of fs in f_frsize units */


Note how the field called "f_blocks" is actually counting fragments, not
blocks.


FWIW, Squid actually started using the block size (r4727) but that bug
got fixed in ~3 days:

> revno: 4738
> committer: wessels
> branch nick: HEAD
> timestamp: Fri 2001-01-05 02:11:49 +0000
> message:
>   With statvfs, f_bsize means something different.  The fundamental block
>   size element is f_frsize.


Your patch is essentially undoing that r4738 fix and re-introducing
r4727 bug.


HTH,

Alex.


More information about the squid-dev mailing list