Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ata Fix build for WD_SOFTBADSECT option. PR kern/52814



details:   https://anonhg.NetBSD.org/src/rev/38cd201d4a79
branches:  trunk
changeset: 358123:38cd201d4a79
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Dec 13 10:24:31 2017 +0000

description:
Fix build for WD_SOFTBADSECT option.  PR kern/52814

XXX No clue if this option actually works.  This fix just makes it
XXX compile without error.

diffstat:

 sys/dev/ata/wd.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r ea9de63ad0c8 -r 38cd201d4a79 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Wed Dec 13 09:46:05 2017 +0000
+++ b/sys/dev/ata/wd.c  Wed Dec 13 10:24:31 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.436 2017/11/07 04:09:08 mlelstv Exp $ */
+/*     $NetBSD: wd.c,v 1.437 2017/12/13 10:24:31 pgoyette Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.436 2017/11/07 04:09:08 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.437 2017/12/13 10:24:31 pgoyette Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -535,12 +535,12 @@
 
 #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);
@@ -586,11 +586,13 @@
         */
        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;



Home | Main Index | Thread Index | Old Index