Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Make `sc_ops->sdo_flush' synchronous. The fla...
details: https://anonhg.NetBSD.org/src/rev/4c75686cdb6a
branches: trunk
changeset: 475813:4c75686cdb6a
user: hannken <hannken%NetBSD.org@localhost>
date: Thu Aug 26 09:28:17 1999 +0000
description:
Make `sc_ops->sdo_flush' synchronous. The flags `SDF_FLUSHING' and
`SDF_DIRTY' were never reset because `sddone' doesn't get called from
synchronous scsi commands.
diffstat:
sys/dev/scsipi/sd.c | 22 +++++++++++++++++-----
sys/dev/scsipi/sd_scsi.c | 22 ++++++++++------------
sys/dev/scsipi/sdvar.h | 4 ++--
3 files changed, 29 insertions(+), 19 deletions(-)
diffs (112 lines):
diff -r a45c2b1ced98 -r 4c75686cdb6a sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Thu Aug 26 08:02:10 1999 +0000
+++ b/sys/dev/scsipi/sd.c Thu Aug 26 09:28:17 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.145 1999/05/31 12:05:39 lukem Exp $ */
+/* $NetBSD: sd.c,v 1.146 1999/08/26 09:28:17 hannken Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -437,8 +437,14 @@
* it, do it now.
*/
if ((sd->flags & SDF_DIRTY) != 0 &&
- sd->sc_ops->sdo_flush != NULL)
- (*sd->sc_ops->sdo_flush)(sd, 0);
+ sd->sc_ops->sdo_flush != NULL) {
+ if ((*sd->sc_ops->sdo_flush)(sd, 0)) {
+ printf("%s: cache synchronization failed\n",
+ sd->sc_dev.dv_xname);
+ sd->flags &= ~SDF_FLUSHING;
+ } else
+ sd->flags &= ~(SDF_FLUSHING|SDF_DIRTY);
+ }
scsipi_wait_drain(sd->sc_link);
@@ -953,8 +959,14 @@
* it, flush it. We're cold at this point, so we poll for
* completion.
*/
- if ((sd->flags & SDF_DIRTY) != 0 && sd->sc_ops->sdo_flush != NULL)
- (*sd->sc_ops->sdo_flush)(sd, SCSI_AUTOCONF);
+ if ((sd->flags & SDF_DIRTY) != 0 && sd->sc_ops->sdo_flush != NULL) {
+ if ((*sd->sc_ops->sdo_flush)(sd, SCSI_AUTOCONF)) {
+ printf("%s: cache synchronization failed\n",
+ sd->sc_dev.dv_xname);
+ sd->flags &= ~SDF_FLUSHING;
+ } else
+ sd->flags &= ~(SDF_FLUSHING|SDF_DIRTY);
+ }
}
/*
diff -r a45c2b1ced98 -r 4c75686cdb6a sys/dev/scsipi/sd_scsi.c
--- a/sys/dev/scsipi/sd_scsi.c Thu Aug 26 08:02:10 1999 +0000
+++ b/sys/dev/scsipi/sd_scsi.c Thu Aug 26 09:28:17 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd_scsi.c,v 1.8 1998/10/08 20:21:13 thorpej Exp $ */
+/* $NetBSD: sd_scsi.c,v 1.9 1999/08/26 09:28:18 hannken Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
struct disk_parms *, int));
static int sd_scsibus_get_optparms __P((struct sd_softc *,
struct disk_parms *, int));
-static void sd_scsibus_flush __P((struct sd_softc *, int));
+static int sd_scsibus_flush __P((struct sd_softc *, int));
const struct sd_ops sd_scsibus_ops = {
sd_scsibus_get_parms,
@@ -329,7 +329,7 @@
return (SDGP_RESULT_OK);
}
-static void
+static int
sd_scsibus_flush(sd, flags)
struct sd_softc *sd;
int flags;
@@ -353,16 +353,14 @@
*/
if ((sc_link->scsipi_scsi.scsi_version & SID_ANSII) >= 2 &&
(sc_link->quirks & SDEV_NOSYNCCACHE) == 0) {
+ sd->flags |= SDF_FLUSHING;
bzero(&sync_cmd, sizeof(sync_cmd));
sync_cmd.opcode = SCSI_SYNCHRONIZE_CACHE;
- if (scsipi_command(sc_link,
- (struct scsipi_generic *)&sync_cmd, sizeof(sync_cmd),
- NULL, 0, SDRETRIES, 100000, NULL,
- flags|SCSI_IGNORE_ILLEGAL_REQUEST))
- printf("%s: WARNING: cache synchronization failed\n",
- sd->sc_dev.dv_xname);
- else
- sd->flags |= SDF_FLUSHING;
- }
+ return(scsipi_command(sc_link,
+ (struct scsipi_generic *)&sync_cmd, sizeof(sync_cmd),
+ NULL, 0, SDRETRIES, 100000, NULL,
+ flags|SCSI_IGNORE_ILLEGAL_REQUEST));
+ } else
+ return(0);
}
diff -r a45c2b1ced98 -r 4c75686cdb6a sys/dev/scsipi/sdvar.h
--- a/sys/dev/scsipi/sdvar.h Thu Aug 26 08:02:10 1999 +0000
+++ b/sys/dev/scsipi/sdvar.h Thu Aug 26 09:28:17 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdvar.h,v 1.7 1998/08/17 00:49:03 mycroft Exp $ */
+/* $NetBSD: sdvar.h,v 1.8 1999/08/26 09:28:18 hannken Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
struct sd_ops {
int (*sdo_get_parms) __P((struct sd_softc *, struct disk_parms *,
int));
- void (*sdo_flush) __P((struct sd_softc *, int));
+ int (*sdo_flush) __P((struct sd_softc *, int));
};
#define SDGP_RESULT_OK 0 /* paramters obtained */
#define SDGP_RESULT_OFFLINE 1 /* no media, or otherwise losing */
Home |
Main Index |
Thread Index |
Old Index