NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/52814: WD_SOFTBADSECT option cause build error
The following reply was made to PR kern/52814; it has been noted by GNATS.
From: Paul Goyette <paul%whooppee.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/52814: WD_SOFTBADSECT option cause build error
Date: Wed, 13 Dec 2017 18:11:21 +0800 (+08)
On Wed, 13 Dec 2017, Paul Goyette wrote:
> Looks like (based on WD_SOFTBADSECT code elsewhere), the sc in this block
> should really be the wdsc.
>
> Perhaps try the following?
Here is a more complete patch which should help:
Index: wd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/wd.c,v
retrieving revision 1.436
diff -u -p -r1.436 wd.c
--- wd.c 7 Nov 2017 04:09:08 -0000 1.436
+++ wd.c 13 Dec 2017 10:10:21 -0000
@@ -535,9 +535,9 @@ wddetach(device_t self, int flags)
#ifdef WD_SOFTBADSECT
/* Clean out the bad sector list */
- while (!SLIST_EMPTY(&sc->sc_bslist)) {
- void *head = SLIST_FIRST(&sc->sc_bslist);
- SLIST_REMOVE_HEAD(&sc->sc_bslist, dbs_next);
+ while (!SLIST_EMPTY(&wd->sc_bslist)) {
+ void *head = SLIST_FIRST(&wd->sc_bslist);
+ SLIST_REMOVE_HEAD(&wd->sc_bslist, dbs_next);
free(head, M_TEMP);
}
sc->sc_bscount = 0;
@@ -586,11 +586,13 @@ wdstrategy(struct buf *bp)
*/
if (__predict_false(!SLIST_EMPTY(&wd->sc_bslist))) {
struct disk_badsectors *dbs;
- daddr_t maxblk = blkno + (bp->b_bcount / wd->sc_blksize) - 1;
+ daddr_t maxblk = bp->b_rawblkno +
+ (bp->b_bcount / wd->sc_blksize) - 1;
mutex_enter(&wd->sc_lock);
SLIST_FOREACH(dbs, &wd->sc_bslist, dbs_next)
- if ((dbs->dbs_min <= blkno && blkno <= dbs->dbs_max) ||
+ if ((dbs->dbs_min <= bp->b_rawblkno &&
+ bp->b_rawblkno <= dbs->dbs_max) ||
(dbs->dbs_min <= maxblk && maxblk <= dbs->dbs_max)){
mutex_exit(&wd->sc_lock);
goto err;
+------------------+--------------------------+----------------------------+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses: |
| (Retired) | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+
Home |
Main Index |
Thread Index |
Old Index