Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ata make the software managed bad-sector list optional



details:   https://anonhg.NetBSD.org/src/rev/e722ac4b5354
branches:  trunk
changeset: 569691:e722ac4b5354
user:      drochner <drochner%NetBSD.org@localhost>
date:      Mon Aug 30 09:34:41 2004 +0000

description:
make the software managed bad-sector list optional
(kernel option WD_SOFTBADSECT)

diffstat:

 sys/dev/ata/files.ata |   4 +++-
 sys/dev/ata/wd.c      |  18 ++++++++++++------
 sys/dev/ata/wdvar.h   |   9 +++++++--
 3 files changed, 22 insertions(+), 9 deletions(-)

diffs (146 lines):

diff -r 401b79970e07 -r e722ac4b5354 sys/dev/ata/files.ata
--- a/sys/dev/ata/files.ata     Mon Aug 30 04:57:39 2004 +0000
+++ b/sys/dev/ata/files.ata     Mon Aug 30 09:34:41 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.ata,v 1.10 2004/08/12 04:23:02 thorpej Exp $
+#      $NetBSD: files.ata,v 1.11 2004/08/30 09:34:41 drochner Exp $
 #
 # Config file and device description for machine-independent devices
 # which attach to ATA busses.  Included by ports that need it.  Ports
@@ -11,6 +11,8 @@
 file   dev/ata/wd.c                    wd                      needs-flag
 file   dev/ata/ata_wdc.c               wd & atabus & wdc_common
 
+defflag        WD_SOFTBADSECT
+
 file   dev/ata/ata.c                   (ata_hl | atapi) & atabus
 
 # ATA RAID configuration support
diff -r 401b79970e07 -r e722ac4b5354 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Mon Aug 30 04:57:39 2004 +0000
+++ b/sys/dev/ata/wd.c  Mon Aug 30 09:34:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.291 2004/08/21 00:28:34 thorpej Exp $ */
+/*     $NetBSD: wd.c,v 1.292 2004/08/30 09:34:41 drochner Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.291 2004/08/21 00:28:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.292 2004/08/30 09:34:41 drochner Exp $");
 
 #ifndef ATADEBUG
 #define ATADEBUG
@@ -279,8 +279,9 @@
 
        callout_init(&wd->sc_restart_ch);
        bufq_alloc(&wd->sc_q, BUFQ_DISK_DEFAULT_STRAT()|BUFQ_SORT_RAWBLOCK);
+#ifdef WD_SOFTBADSECT
        SLIST_INIT(&wd->sc_bslist);
-
+#endif
        wd->atabus = adev->adev_bustype;
        wd->openings = adev->adev_openings;
        wd->drvp = adev->adev_drv_data;
@@ -445,6 +446,7 @@
        /* Detach disk. */
        disk_detach(&sc->sc_dk);
 
+#ifdef WD_SOFTBADSECT
        /* Clean out the bad sector list */
        while (!SLIST_EMPTY(&sc->sc_bslist)) {
                void *head = SLIST_FIRST(&sc->sc_bslist);
@@ -452,6 +454,7 @@
                free(head, M_TEMP);
        }
        sc->sc_bscount = 0;
+#endif
 
        /* Get rid of the shutdown hook. */
        if (sc->sc_sdhook != NULL)
@@ -529,6 +532,7 @@
 
        bp->b_rawblkno = blkno;
 
+#ifdef WD_SOFTBADSECT
        /*
         * If the transfer about to be attempted contains only a block that
         * is known to be bad then return an error for the transfer without
@@ -548,6 +552,7 @@
                                goto bad;
                        }
        }
+#endif
 
        /* Queue transfer on drive, activate drive and controller if idle. */
        s = splbio();
@@ -772,6 +777,7 @@
                }
                printf("\n");
 
+#ifdef WD_SOFTBADSECT
                /*
                 * Not all errors indicate a failed block but those that do,
                 * put the block on the bad-block list for the device.  Only
@@ -790,7 +796,7 @@
                        SLIST_INSERT_HEAD(&wd->sc_bslist, dbs, dbs_next);
                        wd->sc_bscount++;
                }
-
+#endif
                bp->b_flags |= B_ERROR;
                bp->b_error = EIO;
                break;
@@ -1128,7 +1134,7 @@
                bad144intern(wd);
                return 0;
 #endif
-
+#ifdef WD_SOFTBADSECT
        case DIOCBSLIST :
        {
                u_int32_t count, missing, skip;
@@ -1182,7 +1188,7 @@
                }
                wd->sc_bscount = 0;
                return 0;
-
+#endif
        case DIOCGDINFO:
                *(struct disklabel *)addr = *(wd->sc_dk.dk_label);
                return 0;
diff -r 401b79970e07 -r e722ac4b5354 sys/dev/ata/wdvar.h
--- a/sys/dev/ata/wdvar.h       Mon Aug 30 04:57:39 2004 +0000
+++ b/sys/dev/ata/wdvar.h       Mon Aug 30 09:34:41 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdvar.h,v 1.26 2003/12/14 05:38:20 thorpej Exp $       */
+/*     $NetBSD: wdvar.h,v 1.27 2004/08/30 09:34:42 drochner Exp $      */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -32,6 +32,10 @@
 #ifndef _DEV_ATA_WDVAR_H_
 #define        _DEV_ATA_WDVAR_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_wd_softbadsect.h"
+#endif
+
 struct wd_softc {
        /* General disk infos */
        struct device sc_dev;
@@ -67,9 +71,10 @@
 
        void *sc_sdhook;                /* our shutdown hook */
 
+#ifdef WD_SOFTBADSECT
        SLIST_HEAD(, disk_badsectors)   sc_bslist;
        u_int sc_bscount;
-
+#endif
 #if NRND > 0
        rndsource_element_t     rnd_source;
 #endif



Home | Main Index | Thread Index | Old Index