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: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/52814: WD_SOFTBADSECT option cause build error
Date: Wed, 13 Dec 2017 17:23:28 -0000 (UTC)
taca%back-street.net@localhost writes:
>/usr/src/sys/dev/ata/wd.c: In function 'wdstrategy':
>/usr/src/sys/dev/ata/wd.c:589:20: error: 'blkno' undeclared (first use in this function)
> daddr_t maxblk = blkno + (bp->b_bcount / wd->sc_blksize) - 1;
Maybe this:
Index: sys/dev/ata/wd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ata/wd.c,v
retrieving revision 1.436
diff -p -u -r1.436 wd.c
--- sys/dev/ata/wd.c 7 Nov 2017 04:09:08 -0000 1.436
+++ sys/dev/ata/wd.c 13 Dec 2017 17:22:47 -0000
@@ -535,12 +535,12 @@ 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;
+ wd->sc_bscount = 0;
#endif
pmf_device_deregister(self);
@@ -585,8 +585,18 @@ wdstrategy(struct buf *bp)
* up failing again.
*/
if (__predict_false(!SLIST_EMPTY(&wd->sc_bslist))) {
+ struct disklabel *lp = dksc->sc_dkdev.dk_label;
struct disk_badsectors *dbs;
- daddr_t maxblk = blkno + (bp->b_bcount / wd->sc_blksize) - 1;
+ daddr_t blkno, maxblk;
+
+ /* convert the block number to absolute */
+ if (lp->d_secsize >= DEV_BSIZE)
+ blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE);
+ else
+ blkno = bp->b_blkno * (DEV_BSIZE / lp->d_secsize);
+ if (WDPART(bp->b_dev) != RAW_PART)
+ blkno += lp->d_partitions[WDPART(bp->b_dev)].p_offset;
+ maxblk = blkno + (bp->b_bcount / wd->sc_blksize) - 1;
mutex_enter(&wd->sc_lock);
SLIST_FOREACH(dbs, &wd->sc_bslist, dbs_next)
--
--
Michael van Elst
Internet: mlelstv%serpens.de@localhost
"A potential Snark may lurk in every tree."
Home |
Main Index |
Thread Index |
Old Index