Subject: Re: kern/3460: block io unit for sd should be sector size
To: None <>
From: Koji Imada - je4wob/2 <>
List: netbsd-bugs
Date: 04/09/1997 01:11:43
>>>>> "Chris" == Chris G Demetriou <> writes:

 Chris> Do your patches allow for disks where the disklabel's notion of the
 Chris> block size is > the actual disk block size (obviously, a power-of-two
 Chris> multiple 8-) to be used correctly?

Does this mean that sector size in disklabel is bigger than actual
sector size? I think it's impossible in current
implementation. Because scsi disk driver invokes SCSI command
according to disklabel information. In the case of 512 bytes real
sector size and 1024 bytes in disklabel information, one block read
request can read only half of that. Because block count in SCSI
command is calculated with sector size in disklabel(1024 bytes -> 1
block), It is interpreted as 'read one sector(512 bytes)'.

I have tried this. :-)

 Chris> For instance, if I want to set up a FFS file system for use on a
 Chris> CD-ROM, i'd want to set up the disklabel for 2k blocks and the file
 Chris> system to use 2k fragments.  Could such an image be used on a
 Chris> 512-byte-block disk?

This means that making necessary size'ed partition according to real
sector size(512bytes in my example, disklabel information should use
"real" sector size) and make file system as if sector size is 2k

Answer to this question is yes and no.

I have attempted to use ffs on 640MB(2k bytes sector) MO and
implemented 2 ways.

First is to modify file system code to access Disks in DEV_BSIZE unit
and used current translation code of sd.c(disklabel modification is
needed). I have sent mail to tech-kern about this. In this method,
answer to question is yes. I made two same size partition on same MO
and newfs'ed one with '-S 1024' and another in ordinary way. Both
partition can be mounted and read.

Second is send-pr'ed one. Deleted translation in sd.c and not modified 
file system code. In this method, answer is no. Ordinary partition
seems ok, But partition with '-S 1024' is not good. It can be mounted,
but can't access directory.

In any case, disklabel routine in sys/arch/<type>/<type>/disksubr.c
needs some modification.

 Chris> If you'd not considered that, could you?  (and please test it?  8-)

This seems interesting. If core team decided to use DEV_BSIZE unit for 
block io of disk drives(not file system). I want new field to convert 
sector size in superblock to DEV_BSIZE unit in struct fs  which will
be calculated when mounting.

I don't leave DEV_BSIZE dependent constant in physical file system. so
i think DEV_BSIZE dependent part in ffs needs clean up any way.

BTW, is di_blocks in i-node on disk counted in sectors or DEV_BSIZE?
It seems to be former and in former case, btodb and dbtob in ffs code
doesn't seem adequate. How?
Koji Imada