Subject: Re: Supporting sector size != DEV_BSIZE
To: Trevin Beattie <trevin@xmission.com>
From: Robert Elz <kre@munnari.OZ.AU>
List: tech-kern
Date: 06/12/2002 20:58:02
    Date:        Mon, 10 Jun 2002 09:46:07 -0700
    From:        Trevin Beattie <trevin@xmission.com>
    Message-ID:  <3.0.32.20020610094326.006f5df4@clay.wh.ca.us>


  | But strangely, the definition of st_blocks as the "number of
  | blocks allocated for this object" does not define what the size of those
  | blocks are, esp. whether the blocks are a constant size or in terms of
  | st_blksize.

Certainly not the latter - that's typically the "large" block size,
but doesn't actually have to be related to anything specific to the
filesystem at all - it is providing a hint to applications about what
is a nice size to buffer output for optimum performance.   It would
not be unreasonable on an 8k/1k filesystem for that to be 64K or
something.   Mostly it is going to get set to the filesys (large, not
frag, or sector) block size, but nothing should be depending upon that.

In any case, it is too coarse, the st_blocks needs to be in units that
will be no bigger than the minimum allocation unit possible anywhere (and
while floppies have 128 byte sectors, or once did, and I have used drives
where the sector size was 256 bytes, in practice, nothing today is likely
to use less than 512).

  | The only reference to a specific size that I could find was in the
  | rationale section for the du(1) program:

While that's related, it is actually talking about something a little
different.

kre