Subject: Re: kern/3460: block io unit for sd should be sector size
To: Koji Imada - je4wob/2 <koji@math.human.nagoya-u.ac.jp>
From: Chris G. Demetriou <cgd@cs.cmu.edu>
List: netbsd-bugs
Date: 04/09/1997 00:04:07
>  Chris> Uh, unfortunately, I don't understand the question.  8-)
> 
> I mean 'Sector size in filesystem' as sector size calculated from
> fragment size and fs_nspf(number of sectors per fragment). This value
> is retrieved from disklabel in usual case. But using '-S' and other
> options of newfs, I can make file system which is same as dd'ed image
> of file system created on 1k physical('disklabel') sector size media.
> 
> 'question' i understood was on a 512bytes/sector disk
> 
> 	disklabel sector size == 512
> 	partition boundaries, etc., in disklabel are in units of
> 		512, since that's the disklabel sector size.
> 	FFS file system with 1k frag and 1k file system sector size.
> 
> is ok or not.

I'm not sure.

Thinking about it, i don't think that should work.

in that case, frag size would be 1k, nspf would be 1, but 1 * the
disklabel sector size (512) != 1k.

Unfortunately, i'm not sure how this is _supposed_ to work.  Looking
at the comments in the FFS code, which say "assumes DEV_BSIZE byte
sector size," doesn't help.


> Disk image from 1k/sector disk on 512 bytes/sector disk
> 
> 	disklabel sector size = 1k
> 	partition boundaries, etc., in disklabel are in units of
> 		1k, since that's the disklabel sector size.
> 	FFS file systems should be built with a 1k frag size, etc.
> 
> is ok.

This should definitely work, yes.


> And
> 
> 	disklabel sector size = 512
> 	partition boundaries, etc., in disklabel are in units of
> 		512, since that's the disklabel sector size.
> 	FFS file systems image from 1k/sector disk(1k frag).
> 	FFS file systems built as usual.
> 
> is ok too(2 file systems exist in separate partition).

Isn't this the same as the first example, above?  I'm still not sure
that it should work.  (The manual pages indicate that it should, but i
don't know if it currently _does_.)


> After all, using second method, disklabel sector size with same file
> system sector size on disk with smaller or equal physical sector size
> is ok.

disklabel sector size == file system sector size

and

disklabel sector size >= (and a power-of-two-multiple of) physical
sector size

should be OK, yes.


> Using First method, disklabel sector size greater than or equal to
> physical sector size and file system sector size greater than or equal 
> to physical sector size is ok.

This case is:

disklabel sector size >= physical sector size

file system sector size >= physical sector size

disklabel sector size (not necessarily ==) file system sector size


I'm not sure that this should work, especially for cases where file
system sector size is less than the disklabel sector size, but it it
_can_ be made to work reliably I think this is the best (since this is
a superset of the functionality of the other method).


> Which is preferable?

Assuming it can be made to work reliably, the latter (what you're
calling the "first method"), since it provides all the funcitionaly of
the "second method," and more.


chris