make the software managed bad-sector list optional
(kernel option WD_SOFTBADSECT)
This commit is contained in:
parent
08c7699414
commit
b4b2fd9326
@ -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 @@ attach wd at ata_hl
|
||||
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
|
||||
|
@ -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 @@ wdattach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
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 @@ wddetach(struct device *self, int flags)
|
||||
/* 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 @@ wddetach(struct device *self, int flags)
|
||||
free(head, M_TEMP);
|
||||
}
|
||||
sc->sc_bscount = 0;
|
||||
#endif
|
||||
|
||||
/* Get rid of the shutdown hook. */
|
||||
if (sc->sc_sdhook != NULL)
|
||||
@ -529,6 +532,7 @@ wdstrategy(struct buf *bp)
|
||||
|
||||
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 @@ wdstrategy(struct buf *bp)
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Queue transfer on drive, activate drive and controller if idle. */
|
||||
s = splbio();
|
||||
@ -772,6 +777,7 @@ retry2:
|
||||
}
|
||||
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 @@ retry2:
|
||||
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 @@ wdioctl(dev_t dev, u_long xfer, caddr_t addr, int flag, struct proc *p)
|
||||
bad144intern(wd);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
#ifdef WD_SOFTBADSECT
|
||||
case DIOCBSLIST :
|
||||
{
|
||||
u_int32_t count, missing, skip;
|
||||
@ -1182,7 +1188,7 @@ wdioctl(dev_t dev, u_long xfer, caddr_t addr, int flag, struct proc *p)
|
||||
}
|
||||
wd->sc_bscount = 0;
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
case DIOCGDINFO:
|
||||
*(struct disklabel *)addr = *(wd->sc_dk.dk_label);
|
||||
return 0;
|
||||
|
@ -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 @@ struct wd_softc {
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user