tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: >512bytes/sector support (Re: Support for 4KB sectors size disk ?)



david%l8s.co.uk@localhost wrote:

> On Tue, Jan 12, 2010 at 10:48:04PM +0900, Izumi Tsutsui wrote:
> > In traditional implementation, DEV_BSIZE means minimum I/O size of
> > hardware devices, and it's always same as hardware sector size.
> >     
> > To support >512bytes/sector devices, we may have two choice:
> >  (1) make DEV_BSIZE (I/O size) variable (per hardware sector size)
> >  (2) keep DEV_BSIZE (I/O size) constant (traditional 512bytes)
> > 
> > For the former, we need less fixes in file system code
> > (just nuke DEV_BSIZE constant and replece it with "sector size"
> >  value stored somewhere), but we have to rewrite all physio(9)
> > and friend functions to take actual sector size for I/O unit.
> > 
> > For the latter, we don't have to fix I/O functions, but
> > we have to add conversions from sector (disk block) size to
> > DEV_BSIZE in all file system code (and more other places).
> > For example, currently number of disk blocks calculated by
> > fsbtodb() is directly passed to bread(9) and getblk(9) in ffs.
> 
> No, the translation is all done with in the disk driver.
> The fs code will request transfers in multiples of DEV_BSIZE (or 512).

Then you have to redefine meanings of "disk block" in FFS (and all other
file system) structures and fix newfs(8) command to put proper
fs_fsbtodb and related vaules.

> The trawl is actually through the disk drivers to ensure they use the
> physical sector size - not DEV_BSIZE and not a value that happens
> to be in the lable.
> 
> Partitions and filesystem blocks/fragments will need to be suitable
> aligned - since the disk driver will likely reject requests that are
> not for a whole number of physical sectors - like they do now when
> asked to read a number of bytes.

As I wrote first, we should make a decision of buffercache(9)
and physio(9) APIs for !512bytes/sector disks.
Fixing file systems or disk drivers without it just generates
yet another random inconsisntent patch because there is no "right" fix.
We have to consider which should be used hardware sector size or
min I/O size everywhere DEV_BSIZE and "disk block (fsbtodb, blkno etc)"
are referred.
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index