Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi sd_interpret_sense() can be called from inter...
details: https://anonhg.NetBSD.org/src/rev/f40b0ca2b5bc
branches: trunk
changeset: 486494:f40b0ca2b5bc
user: bouyer <bouyer%NetBSD.org@localhost>
date: Tue May 23 10:20:14 2000 +0000
description:
sd_interpret_sense() can be called from interrupt context; call scsipi_start()
with XS_CTL_ASYNC if the failed command was called with XS_CTL_ASYNC.
Add a SDF_RESTART flag to keep state, cleared in sddone().
A mounted disk can now spin down, it will propely spin up at the next access.
diffstat:
sys/dev/scsipi/sd.c | 15 +++++++++++++--
sys/dev/scsipi/sdvar.h | 3 ++-
2 files changed, 15 insertions(+), 3 deletions(-)
diffs (56 lines):
diff -r 58c1de329e11 -r f40b0ca2b5bc sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Tue May 23 10:16:43 2000 +0000
+++ b/sys/dev/scsipi/sd.c Tue May 23 10:20:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.160 2000/05/16 05:45:52 thorpej Exp $ */
+/* $NetBSD: sd.c,v 1.161 2000/05/23 10:20:14 bouyer Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -782,6 +782,10 @@
/* Flush completed, no longer dirty. */
sd->flags &= ~(SDF_FLUSHING|SDF_DIRTY);
}
+ if (sd->flags & SDF_RESTART) {
+ sd->flags &= ~SDF_RESTART;
+ return;
+ }
if (xs->bp != NULL) {
disk_unbusy(&sd->sc_dk, xs->bp->b_bcount - xs->bp->b_resid);
@@ -1145,10 +1149,17 @@
sd->sc_dev.dv_xname);
retval = EIO;
} else {
+ if (sd->flags & SDF_RESTART)
+ return SCSIRET_RETRY;
+ sd->flags |= SDF_RESTART;
printf("%s: respinning up disk\n",
sd->sc_dev.dv_xname);
retval = scsipi_start(sd->sc_link, SSS_START,
- XS_CTL_URGENT | XS_CTL_NOSLEEP);
+ XS_CTL_URGENT | XS_CTL_NOSLEEP |
+ ((xs->xs_control & XS_CTL_ASYNC) ?
+ XS_CTL_ASYNC : 0));
+ if ((xs->xs_control & XS_CTL_ASYNC) == 0)
+ sd->flags &= ~SDF_RESTART;
if (retval != 0) {
printf(
"%s: respin of disk failed - %d\n",
diff -r 58c1de329e11 -r f40b0ca2b5bc sys/dev/scsipi/sdvar.h
--- a/sys/dev/scsipi/sdvar.h Tue May 23 10:16:43 2000 +0000
+++ b/sys/dev/scsipi/sdvar.h Tue May 23 10:20:14 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdvar.h,v 1.11 2000/01/22 16:35:25 drochner Exp $ */
+/* $NetBSD: sdvar.h,v 1.12 2000/05/23 10:20:15 bouyer Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -74,6 +74,7 @@
#define SDF_ANCIENT 0x10 /* disk is ancient; for minphys */
#define SDF_DIRTY 0x20 /* disk is dirty; needs cache flush */
#define SDF_FLUSHING 0x40 /* flushing, for sddone() */
+#define SDF_RESTART 0x80 /* we issued a scsi_start command */
struct scsipi_link *sc_link; /* contains our targ, lun, etc. */
struct disk_parms {
u_long heads; /* number of heads */
Home |
Main Index |
Thread Index |
Old Index