Subject: port-i386/3458: unit of block io and disklabel should be physical sector size
To: None <gnats-bugs@gnats.netbsd.org>
From: None <koji@math.human.nagoya-u.ac.jp>
List: netbsd-bugs
Date: 04/08/1997 10:28:24
>Number: 3458
>Category: port-i386
>Synopsis: unit of block io and disklabel should be physical sector size
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Mon Apr 7 18:35:00 1997
>Last-Modified:
>Originator: Koji Imada - je4owb/2
>Organization:
Mathematics Group of Graduate School of Human
Infomatics, Nagoya University, Japan.
>Release: 970330
>Environment:
System: NetBSD bimota 1.2D NetBSD 1.2D (BIMOTA) #3: Mon Mar 31 01:14:23 JST 1997 koji@bimota:/usr/local/work/current/src/sys/arch/i386/compile/BIMOTA i386
>Description:
unit of block io and disklabel information should be physical
sector size. In current NetBSD implementation, this seems to
be a little confused.
Disklabel routines and sd code assumes b_blkno in struct buf
is in DEV_BSIZE unit and disklabel routine is incomplete.
So using non-512 bytes/sector media is not easy.
Similar modification may be needed each port.
>How-To-Repeat:
>Fix:
apply following patch
Index: sys/arch/i386/i386/disksubr.c
===================================================================
RCS file: /mnt2/NetBSD/cvsroot/netbsd/sys/arch/i386/i386/disksubr.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 disksubr.c
*** disksubr.c 1997/04/01 07:21:40 1.1.1.2
--- disksubr.c 1997/04/07 21:44:56
***************
*** 391,397 ****
goto bad;
}
/* Otherwise, truncate request. */
! bp->b_bcount = sz << DEV_BSHIFT;
}
/* Overwriting disk label? */
--- 391,397 ----
goto bad;
}
/* Otherwise, truncate request. */
! bp->b_bcount = sz * lp->d_secsize;
}
/* Overwriting disk label? */
***************
*** 405,412 ****
}
/* calculate cylinder for disksort to order transfers with */
! bp->b_cylin = (bp->b_blkno + p->p_offset) /
! (lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
return (1);
bad:
--- 405,411 ----
}
/* calculate cylinder for disksort to order transfers with */
! bp->b_cylin = (bp->b_blkno + p->p_offset) / lp->d_secpercyl;
return (1);
bad:
>Audit-Trail:
>Unformatted: