Subject: Re: problem with RAIDframe setup (my mistake) setting a root mirror
To: Greg Oster <oster@cs.usask.ca>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-users
Date: 05/08/2006 16:33:59
--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, May 07, 2006 at 05:45:58PM -0600, Greg Oster wrote:
> Carl Brewer writes:
> > 
> > Hello,
> > 
> > I've made some mistake with disklabel I think, trying to set up a root
> > mirror on a pair of 160GB IDE HDD's on an i386 box.
> 
> You havn't said, but I highly suspect these are Seagate drives, yes? 
> 
> > Fresh install of NetBSD i386 3.0.
> > 
> > When I run the reconstruct to bring the second disk online :
> > 
> > {24} raidctl -S raid0
> > Reconstruction is 0% complete.
> > Parity Re-write is 100% complete.
> > Copyback is 100% complete.
> > Reconstruction status:
> >   85% |**********************************     | ETA:    12:16 /
> > 
> > and then this in /var/log/messages :
> > 
> > May  8 13:45:54  /netbsd: wd0a: error reading fsbn 268435392 of 
> > 268435392-268435519 (wd0 bn 268435455; cn 266305 tn 0 sn 15), retrying
> 
> Search for "268435392" in Google...  You havn't done anything wrong, 
> and it's not a RAIDframe issue -- some Seagate drives need a "quirk 
> entry" to operate with NetBSD 3.0...  One quick solution is to simply 

Hum, it may be another issue here: 268435392 is not the "magic" number.
And this drive seems to be an older revision, which shouldn't have the
problem.

But this request is crossing the 128Gb barrier, this can be an issue
(and I would understand a drive bailing on this). Carl, can you try the
attached patch ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: wd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/wd.c,v
retrieving revision 1.323
diff -u -r1.323 wd.c
--- wd.c	5 Apr 2006 02:40:57 -0000	1.323
+++ wd.c	8 May 2006 14:33:24 -0000
@@ -658,6 +658,7 @@
 __wdstart(struct wd_softc *wd, struct buf *bp)
 {
 
+	int nblks = bp->b_bcount / 512;
 	/*
 	 * Deal with the "split mod15 write" quirk.  We just divide the
 	 * transfer in two, doing the first half and then then second half
@@ -668,8 +669,8 @@
 	 */
 	if (__predict_false((wd->sc_quirks & WD_QUIRK_SPLIT_MOD15_WRITE) != 0 &&
 			    (bp->b_flags & B_READ) == 0 &&
-			    bp->b_bcount > 512 &&
-			    ((bp->b_bcount / 512) % 15) == 1)) {
+			    nblks > 1 &&
+			    (nblks % 15) == 1)) {
 		struct buf *nbp;
 
 		/* already at splbio */
@@ -720,7 +721,7 @@
 	else
 		wd->sc_wdc_bio.flags = 0;
 	if (wd->sc_flags & WDF_LBA48 &&
-	    (wd->sc_wdc_bio.blkno > LBA48_THRESHOLD ||
+	    ((wd->sc_wdc_bio.blkno + nblks) > (LBA48_THRESHOLD + 1) ||
 	    (wd->sc_quirks & WD_QUIRK_FORCE_LBA48) != 0))
 		wd->sc_wdc_bio.flags |= ATA_LBA48;
 	if (wd->sc_flags & WDF_LBA)

--17pEHd4RhPHOinZp--