summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-08 08:01:31 +0000
committerphk <phk@FreeBSD.org>2003-03-08 08:01:31 +0000
commite01fc931cfd9bda87619e5079027111673291cd0 (patch)
tree040efa2f46ce483cf5b045724c67c81b1d43d147 /sys/cam
parenta7246ed45b4e70820cc609b9abd0dc340fd24782 (diff)
downloadFreeBSD-src-e01fc931cfd9bda87619e5079027111673291cd0.zip
FreeBSD-src-e01fc931cfd9bda87619e5079027111673291cd0.tar.gz
Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c. As a side effect this makes a lot of #include <sys/devicestat.h> lines not needed and some biofinish() calls can be reduced to biodone() again.
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_periph.h2
-rw-r--r--sys/cam/cam_xpt.c1
-rw-r--r--sys/cam/scsi/scsi_da.c44
-rw-r--r--sys/cam/scsi/scsi_low.c1
-rw-r--r--sys/cam/scsi/scsi_ses.c1
5 files changed, 11 insertions, 38 deletions
diff --git a/sys/cam/cam_periph.h b/sys/cam/cam_periph.h
index ac32256..9f27180 100644
--- a/sys/cam/cam_periph.h
+++ b/sys/cam/cam_periph.h
@@ -35,6 +35,8 @@
#ifdef _KERNEL
+struct devstat;
+
extern struct cam_periph *xpt_periph;
extern struct periph_driver **periph_drivers;
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 0678380..a272a3e 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -38,7 +38,6 @@
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/md5.h>
-#include <sys/devicestat.h>
#include <sys/interrupt.h>
#include <sys/sbuf.h>
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 26e8cc3..d1dab09 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -116,7 +116,6 @@ struct disk_params {
struct da_softc {
struct bio_queue_head bio_queue;
- struct devstat device_stats;
SLIST_ENTRY(da_softc) links;
LIST_HEAD(, ccb_hdr) pending_ccbs;
da_state state;
@@ -569,7 +568,7 @@ daopen(struct disk *dp)
error = cam_periph_runccb(ccb, daerror,
/*cam_flags*/CAM_RETRY_SELTO,
/*sense_flags*/SF_RETRY_UA,
- &softc->device_stats);
+ softc->disk.d_devstat);
if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(ccb->ccb_h.path,
@@ -591,16 +590,8 @@ daopen(struct disk *dp)
/* XXX: these are not actually "firmware" values, so they may be wrong */
softc->disk.d_fwsectors = softc->params.secs_per_track;
softc->disk.d_fwheads = softc->params.heads;
-
- /*
- * Check to see whether or not the blocksize is set yet.
- * If it isn't, set it and then clear the blocksize
- * unavailable flag for the device statistics.
- */
- if ((softc->device_stats.flags & DEVSTAT_BS_UNAVAILABLE) != 0){
- softc->device_stats.block_size = softc->params.secsize;
- softc->device_stats.flags &= ~DEVSTAT_BS_UNAVAILABLE;
- }
+ softc->disk.d_devstat->block_size = softc->params.secsize;
+ softc->disk.d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE;
}
if (error == 0) {
@@ -647,7 +638,7 @@ daclose(struct disk *dp)
cam_periph_runccb(ccb, /*error_routine*/NULL, /*cam_flags*/0,
/*sense_flags*/SF_RETRY_UA,
- &softc->device_stats);
+ softc->disk.d_devstat);
if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
if ((ccb->ccb_h.status & CAM_STATUS_MASK) ==
@@ -688,7 +679,7 @@ daclose(struct disk *dp)
* unavailable, since it could change when new media is
* inserted.
*/
- softc->device_stats.flags |= DEVSTAT_BS_UNAVAILABLE;
+ softc->disk.d_devstat->flags |= DEVSTAT_BS_UNAVAILABLE;
}
softc->flags &= ~DA_FLAG_OPEN;
@@ -976,7 +967,6 @@ dacleanup(struct cam_periph *periph)
softc = (struct da_softc *)periph->softc;
- devstat_remove_entry(&softc->device_stats);
xpt_print_path(periph->path);
printf("removing device entry\n");
disk_destroy(&softc->disk);
@@ -1187,20 +1177,6 @@ daregister(struct cam_periph *periph, void *arg)
splx(s);
/*
- * The DA driver supports a blocksize, but
- * we don't know the blocksize until we do
- * a read capacity. So, set a flag to
- * indicate that the blocksize is
- * unavailable right now. We'll clear the
- * flag as soon as we've done a read capacity.
- */
- devstat_add_entry(&softc->device_stats, "da",
- periph->unit_number, 0,
- DEVSTAT_BS_UNAVAILABLE,
- SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI,
- DEVSTAT_PRIORITY_DISK);
-
- /*
* Register this media as a disk
*/
@@ -1276,8 +1252,6 @@ dastart(struct cam_periph *periph, union ccb *start_ccb)
bioq_remove(&softc->bio_queue, bp);
- devstat_start_transaction(&softc->device_stats);
-
if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) {
softc->flags &= ~DA_FLAG_NEED_OTAG;
softc->ordered_tag_count++;
@@ -1510,10 +1484,10 @@ dadone(struct cam_periph *periph, union ccb *done_ccb)
LIST_REMOVE(&done_ccb->ccb_h, periph_links.le);
splx(oldspl);
- if (softc->device_stats.busy_count == 0)
+ if (softc->disk.d_devstat->busy_count == 0)
softc->flags |= DA_FLAG_WENT_IDLE;
- biofinish(bp, &softc->device_stats, 0);
+ biodone(bp);
break;
}
case DA_CCB_PROBE:
@@ -1731,7 +1705,7 @@ daprevent(struct cam_periph *periph, int action)
5000);
error = cam_periph_runccb(ccb, /*error_routine*/NULL, CAM_RETRY_SELTO,
- SF_RETRY_UA, &softc->device_stats);
+ SF_RETRY_UA, softc->disk.d_devstat);
if (error == 0) {
if (action == PR_ALLOW)
@@ -1790,7 +1764,7 @@ dasendorderedtag(void *arg)
&& ((softc->flags & DA_FLAG_WENT_IDLE) == 0)) {
softc->flags |= DA_FLAG_NEED_OTAG;
}
- if (softc->device_stats.busy_count > 0)
+ if (softc->disk.d_devstat->busy_count > 0)
softc->flags &= ~DA_FLAG_WENT_IDLE;
softc->ordered_tag_count = 0;
diff --git a/sys/cam/scsi/scsi_low.c b/sys/cam/scsi/scsi_low.c
index afda113..bcbcb37 100644
--- a/sys/cam/scsi/scsi_low.c
+++ b/sys/cam/scsi/scsi_low.c
@@ -75,7 +75,6 @@
#else
#include <machine/clock.h>
#endif
-#include <sys/devicestat.h>
#endif /* __FreeBSD__ */
#include <sys/buf.h>
diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c
index fcdb450..eb9a532 100644
--- a/sys/cam/scsi/scsi_ses.c
+++ b/sys/cam/scsi/scsi_ses.c
@@ -34,7 +34,6 @@
#include <sys/fcntl.h>
#include <sys/conf.h>
#include <sys/errno.h>
-#include <sys/devicestat.h>
#include <machine/stdarg.h>
#include <cam/cam.h>
OpenPOWER on IntegriCloud