Subject: Re: Disks with 128 or 256 bytes per sector
To: Bill Studenmund <>
From: Chuck Silvers <>
List: tech-kern
Date: 06/03/2001 16:36:19
actually, the BSD design does not prohibit devices with 512-byte sectors
and 1024-byte sectors from co-existing, but there are bugs due to people
misunderstanding how things are supposed to work.

the way it's supposed to work is that the b_blkno field of a struct buf
is always in units of DEV_BSIZE, regardless of the sector size of the device.
this works just fine for devices with a sector size of eg. (2 * DEV_BSIZE),
but somewhere along the way various bits of code were written assuming
that b_blkno is in units of the device's sector size, and it's this mismatch
in assumptions that causes problems.

the only drawbacks that I see with the existing interface are:

 (1) doesn't work so well for devices with a sector size < DEV_BSIZE.
     if someone wants to address sectors which don't fall on DEV_BSIZE
     boundaries they have to do extra buffering in the layer above the
     device driver (most likely a filesystem).
 (2) DEV_BSIZE == 512 with a signed 32-bit b_blkno gives a maximum device
     size of 1 TB, which is getting smaller every day.

the first one I can live with since devices with less than 512-byte sectors
are basically toys at this point, but the second we'll need to do something
about eventually.


On Fri, Jun 01, 2001 at 10:42:45AM -0700, Bill Studenmund wrote:
> It's not ffs or lfs's fault. The problem is that the BSD kernel was
> designed to only support one size of disk blocks, DEV_BSIZE. You can use
> 1k-sector disks with NetBSD, jsut right now ALL your disks have to be
> 1k-sectors. ;-)
> What you can't do now is mix & match. Say have 2k scsi disks and 512 byte
> ide's.
> Take care,
> Bill