Subject: Re: S-ATA RAID with Intel ICH7 not working
To: Timo Schoeler <timo.schoeler@riscworks.net>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: current-users
Date: 05/18/2006 21:32:41
--XsQoSWH+UP9D9v3l
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, May 18, 2006 at 02:13:47PM +0200, Timo Schoeler wrote:
> hi,
> 
> have a look a
> 
> http://mail-index.netbsd.org/current-users/2005/06/20/0016.html
> 
> and
> 
> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/ata/wd.c?rev=1.274.2.8.2.4&content-type=text/x-cvsweb-markup
> 
> i had the same problem, maybe your hard drive needs the same workaround?

No, I think these drives have a different problem (the error sector is not
0xfffffff here), could sombody check if the attached patch works ?
I don't have a way to test ...

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

--XsQoSWH+UP9D9v3l
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)

--XsQoSWH+UP9D9v3l--