Subject: Re: proposal for non-512 bytes/sector block device
To: None <tech-kern@NetBSD.ORG>
From: Christos Zoulas <christos@nyc.deshaw.com>
List: tech-kern
Date: 06/30/1997 19:27:42
In article <199706301548.AAA04002@bimota.imada.math.human.nagoya-u.ac.jp> koji@math.human.nagoya-u.ac.jp (Koji Imada - je4owb/2) writes:

>+		if (sdp->swd_bsize < DEV_BSIZE)
>+			nblks /= (sdp->swd_bsize / DEV_BSIZE);
>+		else
>+			nblks *= (DEV_BSIZE / sdp->swd_bsize);



>+		if (sdp->swd_bsize > DEV_BSIZE)
>+			bp->b_blkno = bn / (sdp->swd_bsize / DEV_BSIZE);
>+		else
>+			bp->b_blkno = bn * (DEV_BSIZE / sdp->swd_bsize);


Isn't it better to write those two as:

		if (sdp->swd_bsize != DEV_BSIZE)
			nblks = (nblks * DEV_BSIZE) / sdp->swd_bsize;



		if (sdp->swd_bsize == DEV_BSIZE)
			bp->b_blkno = bn;
		else
			bp->b_blkno = (bn * DEV_BSIZE) / sdp->swd_bsize;

christos