summaryrefslogtreecommitdiffstats
path: root/sys/isa
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1998-09-15 08:15:30 +0000
committergibbs <gibbs@FreeBSD.org>1998-09-15 08:15:30 +0000
commit1bb65e0d8a28cf476487e517d8b682254d70de95 (patch)
treea8383a03e6bea653e6b5a6659e3f681d88f5f11c /sys/isa
parent6eb110bd6840eb7af7100261e50705539c5206fc (diff)
downloadFreeBSD-src-1bb65e0d8a28cf476487e517d8b682254d70de95.zip
FreeBSD-src-1bb65e0d8a28cf476487e517d8b682254d70de95.tar.gz
Update system to new device statistics code.
Submitted by: "Kenneth D. Merry" <ken@plutotech.com> mike@smith.net.au (Mike Smith)
Diffstat (limited to 'sys/isa')
-rw-r--r--sys/isa/fd.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index b0b2442..8c6a2d6 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.120 1998/07/29 13:00:40 bde Exp $
+ * $Id: fd.c,v 1.121 1998/09/14 19:56:39 sos Exp $
*
*/
@@ -66,12 +66,10 @@
#include <machine/ioctl_fd.h>
#include <sys/disklabel.h>
#include <sys/buf.h>
+#include <sys/devicestat.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/syslog.h>
-#ifdef notyet
-#include <sys/dkstat.h>
-#endif
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/fdreg.h>
@@ -174,11 +172,9 @@ static struct fd_data {
#define FD_NO_TRACK -2
int track; /* where we think the head is */
int options; /* user configurable options, see ioctl_fd.h */
-#ifdef notyet
- int dkunit; /* disk stats unit number */
-#endif
struct callout_handle toffhandle;
struct callout_handle tohandle;
+ struct devstat device_stats;
#ifdef DEVFS
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
@@ -793,18 +789,14 @@ fdattach(struct isa_device *dev)
"rfd%d%c", fdu, 'a' + i);
}
#endif /* DEVFS */
-#ifdef notyet
- if (dk_ndrive < DK_NDRIVE) {
- sprintf(dk_names[dk_ndrive], "fd%d", fdu);
- fd->dkunit = dk_ndrive++;
- /*
- * XXX assume rate is FDC_500KBPS.
- */
- dk_wpms[dk_ndrive] = 500000 / 8 / 2;
- } else {
- fd->dkunit = -1;
- }
-#endif
+ /*
+ * Export the drive to the devstat interface.
+ */
+ devstat_add_entry(&fd->device_stats, "fd",
+ fdu, 512,
+ DEVSTAT_NO_ORDERED_TAGS,
+ DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
+
}
return (1);
@@ -1202,6 +1194,10 @@ fdstrategy(struct buf *bp)
s = splbio();
bufqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
+
+ /* Tell devstat we are starting on the transaction */
+ devstat_start_transaction(&fd->device_stats);
+
fdstart(fdcu);
splx(s);
return;
@@ -1210,7 +1206,6 @@ bad:
biodone(bp);
}
-
/***************************************************************\
* fdstart *
* We have just queued something.. if the controller is not busy *
@@ -1627,6 +1622,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
/* ALL DONE */
fd->skip = 0;
bufq_remove(&fdc->head, bp);
+ /* Tell devstat we have finished with the transaction */
+ devstat_end_transaction(&fd->device_stats,
+ bp->b_bcount - bp->b_resid,
+ DEVSTAT_TAG_NONE,
+ (bp->b_flags & B_READ) ?
+ DEVSTAT_READ : DEVSTAT_WRITE);
biodone(bp);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
@@ -1743,6 +1744,8 @@ retrier(fdcu)
struct subdev *sd;
fdc_p fdc = fdc_data + fdcu;
register struct buf *bp;
+ struct fd_data *fd;
+ int fdu;
bp = bufq_first(&fdc->head);
@@ -1789,6 +1792,13 @@ retrier(fdcu)
bp->b_error = EIO;
bp->b_resid += bp->b_bcount - fdc->fd->skip;
bufq_remove(&fdc->head, bp);
+
+ /* Tell devstat we have finished with the transaction */
+ devstat_end_transaction(&fd->device_stats,
+ bp->b_bcount - bp->b_resid,
+ DEVSTAT_TAG_NONE,
+ (bp->b_flags & B_READ) ? DEVSTAT_READ :
+ DEVSTAT_WRITE);
fdc->fd->skip = 0;
biodone(bp);
fdc->state = FINDWORK;
OpenPOWER on IntegriCloud