Subject: Re: kern/3460: block io unit for sd should be sector size
To: None <cgd@cs.cmu.edu>
From: Koji Imada - je4wob/2 <koji@math.human.nagoya-u.ac.jp>
List: netbsd-bugs
Date: 04/09/1997 12:29:33
>>>>> "Chris" == Chris G Demetriou <cgd@cs.cmu.edu> writes:

 >> I think it's impossible in current

Sorry, 'impossible' is my misunderstanding. ;-X

 Chris> It's not clear to me that that's the "right" behaviour, though.

It's possible with slight modification.

 Chris> In the vast majority of cases (are there any cases in which the SCSI
 Chris> drivers end up not knowing disk devices' block sizes?), the SCSI
 Chris> driver knows the block size of the device.  Trying to use any other
 Chris> block size is likely to be nonsensical; what would it mean, and how
 Chris> could it ever produce a useful result?

right.

 >> Answer to this question is yes and no.

 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.

Anyway, with addition of following patch your question is ok in my
second(send-pr'ed) method. the case of first method is explained after 
patch.

*** sd.c.1	Tue Apr  8 10:05:04 1997
--- sd.c	Wed Apr  9 11:23:09 1997
***************
*** 582,588 ****
  		     p = &sd->sc_dk.dk_label->d_partitions[SDPART(bp->b_dev)];
  		     blkno += p->p_offset;
  		}
! 		nblks = howmany(bp->b_bcount, sd->sc_dk.dk_label->d_secsize);
  
  		/*
  		 *  Fill out the scsi command.  If the transfer will
--- 582,589 ----
  		     p = &sd->sc_dk.dk_label->d_partitions[SDPART(bp->b_dev)];
  		     blkno += p->p_offset;
  		}
! 		blkno *= (sd->sc_dk.dk_label->d_secsize / sd->params.blksize);
! 		nblks = howmany(bp->b_bcount, sd->params.blksize);
  
  		/*
  		 *  Fill out the scsi command.  If the transfer will


In the case of my first method(file system modification is needed).
Applying same diffs of second method, following is possible.

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. 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).

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.

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.

Which is preferable?
--
Koji Imada
koji@math.human.nagoya-u.ac.jp