Update system to new device statistics code.
Submitted by: "Kenneth D. Merry" <ken@plutotech.com> mike@smith.net.au (Mike Smith)
This commit is contained in:
parent
20bf9a142c
commit
b2dfb1f906
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=39228
@ -1,10 +1,10 @@
|
|||||||
# $Id$
|
# $Id: Makefile,v 1.3 1997/02/22 14:22:11 peter Exp $
|
||||||
|
|
||||||
PROG = rpc.rstatd
|
PROG = rpc.rstatd
|
||||||
SRCS = rstatd.c rstat_proc.c
|
SRCS = rstatd.c rstat_proc.c
|
||||||
MAN8 = rpc.rstatd.8
|
MAN8 = rpc.rstatd.8
|
||||||
|
|
||||||
DPADD= ${LIBRPCSVC} ${LIBUTIL} ${LIBKVM}
|
DPADD= ${LIBRPCSVC} ${LIBUTIL} ${LIBKVM} ${LIBDEVSTAT}
|
||||||
LDADD= -lrpcsvc -lutil -lkvm
|
LDADD= -lrpcsvc -lutil -lkvm -ldevstat
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -33,7 +33,7 @@ static char sccsid[] = "from: @(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro
|
|||||||
static char sccsid[] = "from: @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC";
|
static char sccsid[] = "from: @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC";
|
||||||
#endif
|
#endif
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: rstat_proc.c,v 1.9 1998/01/07 07:50:59 charnier Exp $";
|
"$Id: rstat_proc.c,v 1.10 1998/01/19 23:13:19 wpaul Exp $";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -48,6 +48,7 @@ static const char rcsid[] =
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/vmmeter.h>
|
#include <sys/vmmeter.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -59,6 +60,7 @@ static const char rcsid[] =
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <devstat.h>
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_mib.h>
|
#include <net/if_mib.h>
|
||||||
@ -77,14 +79,11 @@ struct nlist nl[] = {
|
|||||||
{ "_cp_time" },
|
{ "_cp_time" },
|
||||||
#define X_CNT 1
|
#define X_CNT 1
|
||||||
{ "_cnt" },
|
{ "_cnt" },
|
||||||
#define X_DKXFER 2
|
|
||||||
{ "_dk_xfer" },
|
|
||||||
#define X_DKNDRIVE 3
|
|
||||||
{ "_dk_ndrive" },
|
|
||||||
{ "" },
|
{ "" },
|
||||||
};
|
};
|
||||||
|
|
||||||
int havedisk __P((void));
|
int havedisk __P((void));
|
||||||
|
void updatexfers __P((int, int *));
|
||||||
void setup __P((void));
|
void setup __P((void));
|
||||||
int stats_service();
|
int stats_service();
|
||||||
|
|
||||||
@ -268,12 +267,8 @@ updatestat()
|
|||||||
hz*(tm.tv_usec - btm.tv_usec)/1000000;
|
hz*(tm.tv_usec - btm.tv_usec)/1000000;
|
||||||
stats_all.s2.v_swtch = cnt.v_swtch;
|
stats_all.s2.v_swtch = cnt.v_swtch;
|
||||||
|
|
||||||
/* XXX - should use sysctl */
|
/* update disk transfers */
|
||||||
if (kvm_read(kd, (long)nl[X_DKXFER].n_value, (char *)stats_all.s1.dk_xfer, sizeof (stats_all.s1.dk_xfer))
|
updatexfers(RSTAT_DK_NDRIVE, stats_all.s1.dk_xfer);
|
||||||
!= sizeof (stats_all.s1.dk_xfer)) {
|
|
||||||
syslog(LOG_ERR, "rstat: can't read dk_xfer from kmem");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
mib[0] = CTL_NET;
|
mib[0] = CTL_NET;
|
||||||
mib[1] = PF_LINK;
|
mib[1] = PF_LINK;
|
||||||
@ -337,19 +332,98 @@ setup()
|
|||||||
int
|
int
|
||||||
havedisk()
|
havedisk()
|
||||||
{
|
{
|
||||||
int dk_ndrive;
|
register int i;
|
||||||
|
struct statinfo stats;
|
||||||
|
int num_devices, retval = 0;
|
||||||
|
|
||||||
if (kvm_nlist(kd, nl) != 0) {
|
if ((num_devices = getnumdevs()) < 0) {
|
||||||
syslog(LOG_ERR, "rstatd: can't get namelist.(d)");
|
syslog(LOG_ERR, "rstatd: can't get number of devices: %s",
|
||||||
exit (1);
|
devstat_errbuf);
|
||||||
}
|
|
||||||
|
|
||||||
if (kvm_read(kd, (long)nl[X_DKNDRIVE].n_value, (char *)&dk_ndrive,
|
|
||||||
sizeof dk_ndrive)!= sizeof dk_ndrive) {
|
|
||||||
syslog(LOG_ERR, "rstat: can't read kmem");
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
return (dk_ndrive != 0);
|
|
||||||
|
if (checkversion() < 0) {
|
||||||
|
syslog(LOG_ERR, "rstatd: %s", devstat_errbuf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
|
||||||
|
bzero(stats.dinfo, sizeof(struct devinfo));
|
||||||
|
|
||||||
|
if (getdevs(&stats) == -1) {
|
||||||
|
syslog(LOG_ERR, "rstatd: can't get device list: %s",
|
||||||
|
devstat_errbuf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
for (i = 0; i < stats.dinfo->numdevs; i++) {
|
||||||
|
if (((stats.dinfo->devices[i].device_type
|
||||||
|
& DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_DIRECT)
|
||||||
|
&& ((stats.dinfo->devices[i].device_type
|
||||||
|
& DEVSTAT_TYPE_PASS) == 0)) {
|
||||||
|
retval = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(stats.dinfo);
|
||||||
|
return(retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
updatexfers(numdevs, devs)
|
||||||
|
int numdevs, *devs;
|
||||||
|
{
|
||||||
|
register int i, j;
|
||||||
|
struct statinfo stats;
|
||||||
|
int num_devices = 0;
|
||||||
|
u_int64_t total_transfers;
|
||||||
|
|
||||||
|
if ((num_devices = getnumdevs()) < 0) {
|
||||||
|
syslog(LOG_ERR, "rstatd: can't get number of devices: %s",
|
||||||
|
devstat_errbuf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkversion() < 0) {
|
||||||
|
syslog(LOG_ERR, "rstatd: %s", devstat_errbuf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
|
||||||
|
bzero(stats.dinfo, sizeof(struct devinfo));
|
||||||
|
|
||||||
|
if (getdevs(&stats) == -1) {
|
||||||
|
syslog(LOG_ERR, "rstatd: can't get device list: %s",
|
||||||
|
devstat_errbuf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0, j = 0; i < stats.dinfo->numdevs && j < numdevs; i++) {
|
||||||
|
if (((stats.dinfo->devices[i].device_type
|
||||||
|
& DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_DIRECT)
|
||||||
|
&& ((stats.dinfo->devices[i].device_type
|
||||||
|
& DEVSTAT_TYPE_PASS) == 0)) {
|
||||||
|
total_transfers = stats.dinfo->devices[i].num_reads +
|
||||||
|
stats.dinfo->devices[i].num_writes +
|
||||||
|
stats.dinfo->devices[i].num_other;
|
||||||
|
/*
|
||||||
|
* XXX KDM If the total transfers for this device
|
||||||
|
* are greater than the amount we can fit in a
|
||||||
|
* signed integer, just set them to the maximum
|
||||||
|
* amount we can fit in a signed integer. I have a
|
||||||
|
* feeling that the rstat protocol assumes 32-bit
|
||||||
|
* integers, so this could well break on a 64-bit
|
||||||
|
* architecture like the Alpha.
|
||||||
|
*/
|
||||||
|
if (total_transfers > INT_MAX)
|
||||||
|
devs[j] = INT_MAX;
|
||||||
|
else
|
||||||
|
devs[j] = total_transfers;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(stats.dinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id$";
|
"$Id: ccdconfig.c,v 1.9 1998/06/04 06:41:26 charnier Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -53,6 +53,7 @@ static const char rcsid[] =
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/ccdvar.h>
|
#include <sys/ccdvar.h>
|
||||||
|
|
||||||
#include "pathnames.h"
|
#include "pathnames.h"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: ccd.c,v 1.35 1998/07/04 22:30:13 julian Exp $ */
|
/* $Id: ccd.c,v 1.36 1998/08/19 10:50:32 sos Exp $ */
|
||||||
|
|
||||||
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
||||||
|
|
||||||
@ -103,6 +103,7 @@
|
|||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#undef KERNEL /* XXX */
|
#undef KERNEL /* XXX */
|
||||||
#include <sys/disk.h>
|
#include <sys/disk.h>
|
||||||
#define KERNEL
|
#define KERNEL
|
||||||
@ -292,9 +293,6 @@ ccdinit(ccd, cpaths, p)
|
|||||||
printf("ccdinit: unit %d\n", ccd->ccd_unit);
|
printf("ccdinit: unit %d\n", ccd->ccd_unit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
cs->sc_dk = ccd->ccd_dk;
|
|
||||||
#endif
|
|
||||||
cs->sc_size = 0;
|
cs->sc_size = 0;
|
||||||
cs->sc_ileave = ccd->ccd_interleave;
|
cs->sc_ileave = ccd->ccd_interleave;
|
||||||
cs->sc_nccdisks = ccd->ccd_ndev;
|
cs->sc_nccdisks = ccd->ccd_ndev;
|
||||||
@ -481,10 +479,12 @@ ccdinit(ccd, cpaths, p)
|
|||||||
ccg->ccg_nsectors = 1024 * (1024 / ccg->ccg_secsize);
|
ccg->ccg_nsectors = 1024 * (1024 / ccg->ccg_secsize);
|
||||||
ccg->ccg_ncylinders = cs->sc_size / ccg->ccg_nsectors;
|
ccg->ccg_ncylinders = cs->sc_size / ccg->ccg_nsectors;
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
/*
|
||||||
if (ccd->ccd_dk >= 0)
|
* Add an devstat entry for this device.
|
||||||
dk_wpms[ccd->ccd_dk] = 32 * (60 * DEV_BSIZE / 2); /* XXX */
|
*/
|
||||||
#endif
|
devstat_add_entry(&cs->device_stats, "ccd", ccd->ccd_unit,
|
||||||
|
ccg->ccg_secsize, DEVSTAT_ALL_SUPPORTED,
|
||||||
|
DEVSTAT_TYPE_ASC0 |DEVSTAT_TYPE_IF_OTHER);
|
||||||
|
|
||||||
cs->sc_flags |= CCDF_INITED;
|
cs->sc_flags |= CCDF_INITED;
|
||||||
cs->sc_cflags = ccd->ccd_flags; /* So we can find out later... */
|
cs->sc_cflags = ccd->ccd_flags; /* So we can find out later... */
|
||||||
@ -776,17 +776,8 @@ ccdstart(cs, bp)
|
|||||||
printf("ccdstart(%x, %x)\n", cs, bp);
|
printf("ccdstart(%x, %x)\n", cs, bp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
/* Record the transaction start */
|
||||||
/*
|
devstat_start_transaction(&cs->device_stats);
|
||||||
* Instrumentation (not very meaningful)
|
|
||||||
*/
|
|
||||||
cs->sc_nactive++;
|
|
||||||
if (cs->sc_dk >= 0) {
|
|
||||||
dk_busy |= 1 << cs->sc_dk;
|
|
||||||
dk_xfer[cs->sc_dk]++;
|
|
||||||
dk_wds[cs->sc_dk] += bp->b_bcount >> 6;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translate the partition-relative block number to an absolute.
|
* Translate the partition-relative block number to an absolute.
|
||||||
@ -909,6 +900,7 @@ ccdbuffer(cb, cs, bp, bn, addr, bcount)
|
|||||||
cbp->cb_buf.b_data = addr;
|
cbp->cb_buf.b_data = addr;
|
||||||
cbp->cb_buf.b_vp = ci->ci_vp;
|
cbp->cb_buf.b_vp = ci->ci_vp;
|
||||||
LIST_INIT(&cbp->cb_buf.b_dep);
|
LIST_INIT(&cbp->cb_buf.b_dep);
|
||||||
|
cbp->cb_buf.b_resid = 0;
|
||||||
if (cs->sc_ileave == 0)
|
if (cs->sc_ileave == 0)
|
||||||
cbp->cb_buf.b_bcount = dbtob(ci->ci_size - cbn);
|
cbp->cb_buf.b_bcount = dbtob(ci->ci_size - cbn);
|
||||||
else
|
else
|
||||||
@ -963,16 +955,14 @@ ccdintr(cs, bp)
|
|||||||
/*
|
/*
|
||||||
* Request is done for better or worse, wakeup the top half.
|
* Request is done for better or worse, wakeup the top half.
|
||||||
*/
|
*/
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
/* Record device statistics */
|
||||||
--cs->sc_nactive;
|
devstat_end_transaction(&cs->device_stats,
|
||||||
#ifdef DIAGNOSTIC
|
bp->b_bcount - bp->b_resid,
|
||||||
if (cs->sc_nactive < 0)
|
(bp->b_flags & B_ORDERED) ?
|
||||||
panic("ccdintr: ccd%d: sc_nactive < 0", cs->sc_unit);
|
DEVSTAT_TAG_ORDERED : DEVSTAT_TAG_SIMPLE,
|
||||||
#endif
|
(bp->b_flags & B_READ) ? DEVSTAT_READ :
|
||||||
|
DEVSTAT_WRITE);
|
||||||
|
|
||||||
if (cs->sc_nactive == 0 && cs->sc_dk >= 0)
|
|
||||||
dk_busy &= ~(1 << cs->sc_dk);
|
|
||||||
#endif
|
|
||||||
if (bp->b_flags & B_ERROR)
|
if (bp->b_flags & B_ERROR)
|
||||||
bp->b_resid = bp->b_bcount;
|
bp->b_resid = bp->b_bcount;
|
||||||
biodone(bp);
|
biodone(bp);
|
||||||
@ -1055,9 +1045,6 @@ ccdioctl(dev, cmd, data, flag, p)
|
|||||||
struct ccddevice ccd;
|
struct ccddevice ccd;
|
||||||
char **cpp;
|
char **cpp;
|
||||||
struct vnode **vpp;
|
struct vnode **vpp;
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
extern int dkn;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (unit >= numccd)
|
if (unit >= numccd)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
@ -1143,27 +1130,10 @@ ccdioctl(dev, cmd, data, flag, p)
|
|||||||
ccd.ccd_vpp = vpp;
|
ccd.ccd_vpp = vpp;
|
||||||
ccd.ccd_ndev = ccio->ccio_ndisks;
|
ccd.ccd_ndev = ccio->ccio_ndisks;
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
/*
|
|
||||||
* Assign disk index first so that init routine
|
|
||||||
* can use it (saves having the driver drag around
|
|
||||||
* the ccddevice pointer just to set up the dk_*
|
|
||||||
* info in the open routine).
|
|
||||||
*/
|
|
||||||
if (dkn < DK_NDRIVE)
|
|
||||||
ccd.ccd_dk = dkn++;
|
|
||||||
else
|
|
||||||
ccd.ccd_dk = -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the ccd. Fills in the softc for us.
|
* Initialize the ccd. Fills in the softc for us.
|
||||||
*/
|
*/
|
||||||
if (error = ccdinit(&ccd, cpp, p)) {
|
if (error = ccdinit(&ccd, cpp, p)) {
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
if (ccd.ccd_dk >= 0)
|
|
||||||
--dkn;
|
|
||||||
#endif
|
|
||||||
for (j = 0; j < lookedup; ++j)
|
for (j = 0; j < lookedup; ++j)
|
||||||
(void)vn_close(vpp[j], FREAD|FWRITE,
|
(void)vn_close(vpp[j], FREAD|FWRITE,
|
||||||
p->p_ucred, p);
|
p->p_ucred, p);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
* 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 <machine/ioctl_fd.h>
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/syslog.h>
|
#include <sys/syslog.h>
|
||||||
#ifdef notyet
|
|
||||||
#include <sys/dkstat.h>
|
|
||||||
#endif
|
|
||||||
#include <i386/isa/isa.h>
|
#include <i386/isa/isa.h>
|
||||||
#include <i386/isa/isa_device.h>
|
#include <i386/isa/isa_device.h>
|
||||||
#include <i386/isa/fdreg.h>
|
#include <i386/isa/fdreg.h>
|
||||||
@ -174,11 +172,9 @@ static struct fd_data {
|
|||||||
#define FD_NO_TRACK -2
|
#define FD_NO_TRACK -2
|
||||||
int track; /* where we think the head is */
|
int track; /* where we think the head is */
|
||||||
int options; /* user configurable options, see ioctl_fd.h */
|
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 toffhandle;
|
||||||
struct callout_handle tohandle;
|
struct callout_handle tohandle;
|
||||||
|
struct devstat device_stats;
|
||||||
#ifdef DEVFS
|
#ifdef DEVFS
|
||||||
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
|
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
|
||||||
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
|
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
|
||||||
@ -793,18 +789,14 @@ fdattach(struct isa_device *dev)
|
|||||||
"rfd%d%c", fdu, 'a' + i);
|
"rfd%d%c", fdu, 'a' + i);
|
||||||
}
|
}
|
||||||
#endif /* DEVFS */
|
#endif /* DEVFS */
|
||||||
#ifdef notyet
|
/*
|
||||||
if (dk_ndrive < DK_NDRIVE) {
|
* Export the drive to the devstat interface.
|
||||||
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
|
*/
|
||||||
fd->dkunit = dk_ndrive++;
|
devstat_add_entry(&fd->device_stats, "fd",
|
||||||
/*
|
fdu, 512,
|
||||||
* XXX assume rate is FDC_500KBPS.
|
DEVSTAT_NO_ORDERED_TAGS,
|
||||||
*/
|
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
|
||||||
dk_wpms[dk_ndrive] = 500000 / 8 / 2;
|
|
||||||
} else {
|
|
||||||
fd->dkunit = -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
@ -1202,6 +1194,10 @@ fdstrategy(struct buf *bp)
|
|||||||
s = splbio();
|
s = splbio();
|
||||||
bufqdisksort(&fdc->head, bp);
|
bufqdisksort(&fdc->head, bp);
|
||||||
untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
|
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);
|
fdstart(fdcu);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
@ -1210,7 +1206,6 @@ fdstrategy(struct buf *bp)
|
|||||||
biodone(bp);
|
biodone(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************\
|
/***************************************************************\
|
||||||
* fdstart *
|
* fdstart *
|
||||||
* We have just queued something.. if the controller is not busy *
|
* We have just queued something.. if the controller is not busy *
|
||||||
@ -1627,6 +1622,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
|||||||
/* ALL DONE */
|
/* ALL DONE */
|
||||||
fd->skip = 0;
|
fd->skip = 0;
|
||||||
bufq_remove(&fdc->head, bp);
|
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);
|
biodone(bp);
|
||||||
fdc->fd = (fd_p) 0;
|
fdc->fd = (fd_p) 0;
|
||||||
fdc->fdu = -1;
|
fdc->fdu = -1;
|
||||||
@ -1743,6 +1744,8 @@ retrier(fdcu)
|
|||||||
struct subdev *sd;
|
struct subdev *sd;
|
||||||
fdc_p fdc = fdc_data + fdcu;
|
fdc_p fdc = fdc_data + fdcu;
|
||||||
register struct buf *bp;
|
register struct buf *bp;
|
||||||
|
struct fd_data *fd;
|
||||||
|
int fdu;
|
||||||
|
|
||||||
bp = bufq_first(&fdc->head);
|
bp = bufq_first(&fdc->head);
|
||||||
|
|
||||||
@ -1789,6 +1792,13 @@ retrier(fdcu)
|
|||||||
bp->b_error = EIO;
|
bp->b_error = EIO;
|
||||||
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
||||||
bufq_remove(&fdc->head, bp);
|
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;
|
fdc->fd->skip = 0;
|
||||||
biodone(bp);
|
biodone(bp);
|
||||||
fdc->state = FINDWORK;
|
fdc->state = FINDWORK;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: ccd.c,v 1.35 1998/07/04 22:30:13 julian Exp $ */
|
/* $Id: ccd.c,v 1.36 1998/08/19 10:50:32 sos Exp $ */
|
||||||
|
|
||||||
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
||||||
|
|
||||||
@ -103,6 +103,7 @@
|
|||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <ufs/ffs/fs.h>
|
#include <ufs/ffs/fs.h>
|
||||||
#include <sys/device.h>
|
#include <sys/device.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#undef KERNEL /* XXX */
|
#undef KERNEL /* XXX */
|
||||||
#include <sys/disk.h>
|
#include <sys/disk.h>
|
||||||
#define KERNEL
|
#define KERNEL
|
||||||
@ -292,9 +293,6 @@ ccdinit(ccd, cpaths, p)
|
|||||||
printf("ccdinit: unit %d\n", ccd->ccd_unit);
|
printf("ccdinit: unit %d\n", ccd->ccd_unit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
cs->sc_dk = ccd->ccd_dk;
|
|
||||||
#endif
|
|
||||||
cs->sc_size = 0;
|
cs->sc_size = 0;
|
||||||
cs->sc_ileave = ccd->ccd_interleave;
|
cs->sc_ileave = ccd->ccd_interleave;
|
||||||
cs->sc_nccdisks = ccd->ccd_ndev;
|
cs->sc_nccdisks = ccd->ccd_ndev;
|
||||||
@ -481,10 +479,12 @@ ccdinit(ccd, cpaths, p)
|
|||||||
ccg->ccg_nsectors = 1024 * (1024 / ccg->ccg_secsize);
|
ccg->ccg_nsectors = 1024 * (1024 / ccg->ccg_secsize);
|
||||||
ccg->ccg_ncylinders = cs->sc_size / ccg->ccg_nsectors;
|
ccg->ccg_ncylinders = cs->sc_size / ccg->ccg_nsectors;
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
/*
|
||||||
if (ccd->ccd_dk >= 0)
|
* Add an devstat entry for this device.
|
||||||
dk_wpms[ccd->ccd_dk] = 32 * (60 * DEV_BSIZE / 2); /* XXX */
|
*/
|
||||||
#endif
|
devstat_add_entry(&cs->device_stats, "ccd", ccd->ccd_unit,
|
||||||
|
ccg->ccg_secsize, DEVSTAT_ALL_SUPPORTED,
|
||||||
|
DEVSTAT_TYPE_ASC0 |DEVSTAT_TYPE_IF_OTHER);
|
||||||
|
|
||||||
cs->sc_flags |= CCDF_INITED;
|
cs->sc_flags |= CCDF_INITED;
|
||||||
cs->sc_cflags = ccd->ccd_flags; /* So we can find out later... */
|
cs->sc_cflags = ccd->ccd_flags; /* So we can find out later... */
|
||||||
@ -776,17 +776,8 @@ ccdstart(cs, bp)
|
|||||||
printf("ccdstart(%x, %x)\n", cs, bp);
|
printf("ccdstart(%x, %x)\n", cs, bp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
/* Record the transaction start */
|
||||||
/*
|
devstat_start_transaction(&cs->device_stats);
|
||||||
* Instrumentation (not very meaningful)
|
|
||||||
*/
|
|
||||||
cs->sc_nactive++;
|
|
||||||
if (cs->sc_dk >= 0) {
|
|
||||||
dk_busy |= 1 << cs->sc_dk;
|
|
||||||
dk_xfer[cs->sc_dk]++;
|
|
||||||
dk_wds[cs->sc_dk] += bp->b_bcount >> 6;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translate the partition-relative block number to an absolute.
|
* Translate the partition-relative block number to an absolute.
|
||||||
@ -909,6 +900,7 @@ ccdbuffer(cb, cs, bp, bn, addr, bcount)
|
|||||||
cbp->cb_buf.b_data = addr;
|
cbp->cb_buf.b_data = addr;
|
||||||
cbp->cb_buf.b_vp = ci->ci_vp;
|
cbp->cb_buf.b_vp = ci->ci_vp;
|
||||||
LIST_INIT(&cbp->cb_buf.b_dep);
|
LIST_INIT(&cbp->cb_buf.b_dep);
|
||||||
|
cbp->cb_buf.b_resid = 0;
|
||||||
if (cs->sc_ileave == 0)
|
if (cs->sc_ileave == 0)
|
||||||
cbp->cb_buf.b_bcount = dbtob(ci->ci_size - cbn);
|
cbp->cb_buf.b_bcount = dbtob(ci->ci_size - cbn);
|
||||||
else
|
else
|
||||||
@ -963,16 +955,14 @@ ccdintr(cs, bp)
|
|||||||
/*
|
/*
|
||||||
* Request is done for better or worse, wakeup the top half.
|
* Request is done for better or worse, wakeup the top half.
|
||||||
*/
|
*/
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
/* Record device statistics */
|
||||||
--cs->sc_nactive;
|
devstat_end_transaction(&cs->device_stats,
|
||||||
#ifdef DIAGNOSTIC
|
bp->b_bcount - bp->b_resid,
|
||||||
if (cs->sc_nactive < 0)
|
(bp->b_flags & B_ORDERED) ?
|
||||||
panic("ccdintr: ccd%d: sc_nactive < 0", cs->sc_unit);
|
DEVSTAT_TAG_ORDERED : DEVSTAT_TAG_SIMPLE,
|
||||||
#endif
|
(bp->b_flags & B_READ) ? DEVSTAT_READ :
|
||||||
|
DEVSTAT_WRITE);
|
||||||
|
|
||||||
if (cs->sc_nactive == 0 && cs->sc_dk >= 0)
|
|
||||||
dk_busy &= ~(1 << cs->sc_dk);
|
|
||||||
#endif
|
|
||||||
if (bp->b_flags & B_ERROR)
|
if (bp->b_flags & B_ERROR)
|
||||||
bp->b_resid = bp->b_bcount;
|
bp->b_resid = bp->b_bcount;
|
||||||
biodone(bp);
|
biodone(bp);
|
||||||
@ -1055,9 +1045,6 @@ ccdioctl(dev, cmd, data, flag, p)
|
|||||||
struct ccddevice ccd;
|
struct ccddevice ccd;
|
||||||
char **cpp;
|
char **cpp;
|
||||||
struct vnode **vpp;
|
struct vnode **vpp;
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
extern int dkn;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (unit >= numccd)
|
if (unit >= numccd)
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
@ -1143,27 +1130,10 @@ ccdioctl(dev, cmd, data, flag, p)
|
|||||||
ccd.ccd_vpp = vpp;
|
ccd.ccd_vpp = vpp;
|
||||||
ccd.ccd_ndev = ccio->ccio_ndisks;
|
ccd.ccd_ndev = ccio->ccio_ndisks;
|
||||||
|
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
/*
|
|
||||||
* Assign disk index first so that init routine
|
|
||||||
* can use it (saves having the driver drag around
|
|
||||||
* the ccddevice pointer just to set up the dk_*
|
|
||||||
* info in the open routine).
|
|
||||||
*/
|
|
||||||
if (dkn < DK_NDRIVE)
|
|
||||||
ccd.ccd_dk = dkn++;
|
|
||||||
else
|
|
||||||
ccd.ccd_dk = -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the ccd. Fills in the softc for us.
|
* Initialize the ccd. Fills in the softc for us.
|
||||||
*/
|
*/
|
||||||
if (error = ccdinit(&ccd, cpp, p)) {
|
if (error = ccdinit(&ccd, cpp, p)) {
|
||||||
#ifdef WORKING_DISK_STATISTICS /* XXX !! */
|
|
||||||
if (ccd.ccd_dk >= 0)
|
|
||||||
--dkn;
|
|
||||||
#endif
|
|
||||||
for (j = 0; j < lookedup; ++j)
|
for (j = 0; j < lookedup; ++j)
|
||||||
(void)vn_close(vpp[j], FREAD|FWRITE,
|
(void)vn_close(vpp[j], FREAD|FWRITE,
|
||||||
p->p_ucred, p);
|
p->p_ucred, p);
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
* 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 <machine/ioctl_fd.h>
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/syslog.h>
|
#include <sys/syslog.h>
|
||||||
#ifdef notyet
|
|
||||||
#include <sys/dkstat.h>
|
|
||||||
#endif
|
|
||||||
#include <i386/isa/isa.h>
|
#include <i386/isa/isa.h>
|
||||||
#include <i386/isa/isa_device.h>
|
#include <i386/isa/isa_device.h>
|
||||||
#include <i386/isa/fdreg.h>
|
#include <i386/isa/fdreg.h>
|
||||||
@ -174,11 +172,9 @@ static struct fd_data {
|
|||||||
#define FD_NO_TRACK -2
|
#define FD_NO_TRACK -2
|
||||||
int track; /* where we think the head is */
|
int track; /* where we think the head is */
|
||||||
int options; /* user configurable options, see ioctl_fd.h */
|
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 toffhandle;
|
||||||
struct callout_handle tohandle;
|
struct callout_handle tohandle;
|
||||||
|
struct devstat device_stats;
|
||||||
#ifdef DEVFS
|
#ifdef DEVFS
|
||||||
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
|
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
|
||||||
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
|
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
|
||||||
@ -793,18 +789,14 @@ fdattach(struct isa_device *dev)
|
|||||||
"rfd%d%c", fdu, 'a' + i);
|
"rfd%d%c", fdu, 'a' + i);
|
||||||
}
|
}
|
||||||
#endif /* DEVFS */
|
#endif /* DEVFS */
|
||||||
#ifdef notyet
|
/*
|
||||||
if (dk_ndrive < DK_NDRIVE) {
|
* Export the drive to the devstat interface.
|
||||||
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
|
*/
|
||||||
fd->dkunit = dk_ndrive++;
|
devstat_add_entry(&fd->device_stats, "fd",
|
||||||
/*
|
fdu, 512,
|
||||||
* XXX assume rate is FDC_500KBPS.
|
DEVSTAT_NO_ORDERED_TAGS,
|
||||||
*/
|
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
|
||||||
dk_wpms[dk_ndrive] = 500000 / 8 / 2;
|
|
||||||
} else {
|
|
||||||
fd->dkunit = -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
@ -1202,6 +1194,10 @@ fdstrategy(struct buf *bp)
|
|||||||
s = splbio();
|
s = splbio();
|
||||||
bufqdisksort(&fdc->head, bp);
|
bufqdisksort(&fdc->head, bp);
|
||||||
untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
|
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);
|
fdstart(fdcu);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
@ -1210,7 +1206,6 @@ fdstrategy(struct buf *bp)
|
|||||||
biodone(bp);
|
biodone(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************\
|
/***************************************************************\
|
||||||
* fdstart *
|
* fdstart *
|
||||||
* We have just queued something.. if the controller is not busy *
|
* We have just queued something.. if the controller is not busy *
|
||||||
@ -1627,6 +1622,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
|||||||
/* ALL DONE */
|
/* ALL DONE */
|
||||||
fd->skip = 0;
|
fd->skip = 0;
|
||||||
bufq_remove(&fdc->head, bp);
|
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);
|
biodone(bp);
|
||||||
fdc->fd = (fd_p) 0;
|
fdc->fd = (fd_p) 0;
|
||||||
fdc->fdu = -1;
|
fdc->fdu = -1;
|
||||||
@ -1743,6 +1744,8 @@ retrier(fdcu)
|
|||||||
struct subdev *sd;
|
struct subdev *sd;
|
||||||
fdc_p fdc = fdc_data + fdcu;
|
fdc_p fdc = fdc_data + fdcu;
|
||||||
register struct buf *bp;
|
register struct buf *bp;
|
||||||
|
struct fd_data *fd;
|
||||||
|
int fdu;
|
||||||
|
|
||||||
bp = bufq_first(&fdc->head);
|
bp = bufq_first(&fdc->head);
|
||||||
|
|
||||||
@ -1789,6 +1792,13 @@ retrier(fdcu)
|
|||||||
bp->b_error = EIO;
|
bp->b_error = EIO;
|
||||||
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
||||||
bufq_remove(&fdc->head, bp);
|
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;
|
fdc->fd->skip = 0;
|
||||||
biodone(bp);
|
biodone(bp);
|
||||||
fdc->state = FINDWORK;
|
fdc->state = FINDWORK;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* all derivative works or modified versions.
|
* all derivative works or modified versions.
|
||||||
*
|
*
|
||||||
* From: Version 1.9, Mon Oct 9 20:27:42 MSK 1995
|
* From: Version 1.9, Mon Oct 9 20:27:42 MSK 1995
|
||||||
* $Id: wcd.c,v 1.57 1998/07/04 22:30:18 julian Exp $
|
* $Id: wcd.c,v 1.58 1998/09/08 20:57:47 sos Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wdc.h"
|
#include "wdc.h"
|
||||||
@ -29,6 +29,7 @@
|
|||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/cdio.h>
|
#include <sys/cdio.h>
|
||||||
#include <sys/conf.h>
|
#include <sys/conf.h>
|
||||||
@ -253,6 +254,7 @@ struct wcd {
|
|||||||
char description[80]; /* Device description */
|
char description[80]; /* Device description */
|
||||||
struct changer *changer_info; /* changer info */
|
struct changer *changer_info; /* changer info */
|
||||||
int slot; /* this lun's slot number */
|
int slot; /* this lun's slot number */
|
||||||
|
struct devstat device_stats; /* devstat parameters */
|
||||||
#ifdef DEVFS
|
#ifdef DEVFS
|
||||||
void *ra_devfs_token;
|
void *ra_devfs_token;
|
||||||
void *rc_devfs_token;
|
void *rc_devfs_token;
|
||||||
@ -328,6 +330,13 @@ wcd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun)
|
|||||||
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
|
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
|
||||||
"wcd%dc", lun);
|
"wcd%dc", lun);
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* Export the unit to the devstat interface.
|
||||||
|
*/
|
||||||
|
devstat_add_entry(&ptr->device_stats, "wcd",
|
||||||
|
lun, SECSIZE,
|
||||||
|
DEVSTAT_NO_ORDERED_TAGS,
|
||||||
|
DEVSTAT_TYPE_CDROM | DEVSTAT_TYPE_IF_IDE);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,6 +646,9 @@ static void wcd_start (struct wcd *t)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tell devstat we are starting on the transaction */
|
||||||
|
devstat_start_transaction(&t->device_stats);
|
||||||
|
|
||||||
wcd_select_slot(t);
|
wcd_select_slot(t);
|
||||||
|
|
||||||
/* We have a buf, now we should make a command
|
/* We have a buf, now we should make a command
|
||||||
@ -661,6 +673,12 @@ static void wcd_done (struct wcd *t, struct buf *bp, int resid,
|
|||||||
bp->b_flags |= B_ERROR;
|
bp->b_flags |= B_ERROR;
|
||||||
} else
|
} else
|
||||||
bp->b_resid = resid;
|
bp->b_resid = resid;
|
||||||
|
|
||||||
|
/* Tell devstat we have finished with the transaction */
|
||||||
|
devstat_end_transaction(&t->device_stats,
|
||||||
|
bp->b_bcount - bp->b_resid,
|
||||||
|
DEVSTAT_TAG_NONE,
|
||||||
|
(bp->b_flags & B_READ) ? DEVSTAT_READ : DEVSTAT_WRITE);
|
||||||
biodone (bp);
|
biodone (bp);
|
||||||
wcd_start (t);
|
wcd_start (t);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
|
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
|
||||||
* $Id: wd.c,v 1.174 1998/08/23 20:16:34 phk Exp $
|
* $Id: wd.c,v 1.175 1998/09/14 19:56:39 sos Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
@ -78,6 +78,7 @@
|
|||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/diskslice.h>
|
#include <sys/diskslice.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#ifdef DEVFS
|
#ifdef DEVFS
|
||||||
#include <sys/devfsext.h>
|
#include <sys/devfsext.h>
|
||||||
@ -90,7 +91,6 @@
|
|||||||
#include <i386/isa/isa_device.h>
|
#include <i386/isa/isa_device.h>
|
||||||
#include <i386/isa/wdreg.h>
|
#include <i386/isa/wdreg.h>
|
||||||
#include <sys/syslog.h>
|
#include <sys/syslog.h>
|
||||||
#include <sys/dkstat.h>
|
|
||||||
#include <vm/vm.h>
|
#include <vm/vm.h>
|
||||||
#include <vm/vm_prot.h>
|
#include <vm/vm_prot.h>
|
||||||
#include <vm/pmap.h>
|
#include <vm/pmap.h>
|
||||||
@ -187,12 +187,13 @@ struct disk {
|
|||||||
*/
|
*/
|
||||||
#define DKFL_LBA 0x02000 /* use LBA for data transfers */
|
#define DKFL_LBA 0x02000 /* use LBA for data transfers */
|
||||||
struct wdparams dk_params; /* ESDI/IDE drive/controller parameters */
|
struct wdparams dk_params; /* ESDI/IDE drive/controller parameters */
|
||||||
int dk_dkunit; /* disk stats unit number */
|
|
||||||
unsigned int dk_multi; /* multi transfers */
|
unsigned int dk_multi; /* multi transfers */
|
||||||
u_int dk_currentiosize; /* current io size */
|
int dk_currentiosize; /* current io size */
|
||||||
struct diskgeom dk_dd; /* device configuration data */
|
struct diskgeom dk_dd; /* device configuration data */
|
||||||
struct diskslices *dk_slices; /* virtual drives */
|
struct diskslices *dk_slices; /* virtual drives */
|
||||||
void *dk_dmacookie; /* handle for DMA services */
|
void *dk_dmacookie; /* handle for DMA services */
|
||||||
|
|
||||||
|
struct devstat dk_stats; /* devstat entry */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define WD_COUNT_RETRIES
|
#define WD_COUNT_RETRIES
|
||||||
@ -539,19 +540,14 @@ wdattach(struct isa_device *dvp)
|
|||||||
"rwd%d", lunit);
|
"rwd%d", lunit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dk_ndrive < DK_NDRIVE) {
|
/*
|
||||||
sprintf(dk_names[dk_ndrive], "wd%d", lunit);
|
* Export the drive to the devstat interface.
|
||||||
/*
|
*/
|
||||||
* XXX we don't know the transfer rate of the
|
devstat_add_entry(&du->dk_stats, "wd",
|
||||||
* drive. Guess the maximum ISA rate of
|
lunit, du->dk_dd.d_secsize,
|
||||||
* 4MB/sec. `wpms' is words per _second_
|
DEVSTAT_NO_ORDERED_TAGS,
|
||||||
* according to iostat.
|
DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE);
|
||||||
*/
|
|
||||||
dk_wpms[dk_ndrive] = 4 * 1024 * 1024 / 2;
|
|
||||||
du->dk_dkunit = dk_ndrive++;
|
|
||||||
} else {
|
|
||||||
du->dk_dkunit = -1;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
free(du, M_TEMP);
|
free(du, M_TEMP);
|
||||||
wddrives[lunit] = NULL;
|
wddrives[lunit] = NULL;
|
||||||
@ -684,21 +680,8 @@ wdstrategy(register struct buf *bp)
|
|||||||
#endif
|
#endif
|
||||||
wdstart(du->dk_ctrlr); /* start controller */
|
wdstart(du->dk_ctrlr); /* start controller */
|
||||||
|
|
||||||
if (du->dk_dkunit >= 0) {
|
/* Tell devstat that we have started a transaction on this drive */
|
||||||
/*
|
devstat_start_transaction(&du->dk_stats);
|
||||||
* XXX perhaps we should only count successful transfers.
|
|
||||||
*/
|
|
||||||
dk_xfer[du->dk_dkunit]++;
|
|
||||||
/*
|
|
||||||
* XXX we can't count seeks correctly but we can do better
|
|
||||||
* than this. E.g., assume that the geometry is correct
|
|
||||||
* and count 1 seek if the starting cylinder of this i/o
|
|
||||||
* differs from the starting cylinder of the previous i/o,
|
|
||||||
* or count 1 seek if the starting bn of this i/o doesn't
|
|
||||||
* immediately follow the ending bn of the previos i/o.
|
|
||||||
*/
|
|
||||||
dk_seek[du->dk_dkunit]++;
|
|
||||||
}
|
|
||||||
|
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
@ -951,9 +934,6 @@ wdstart(int ctrlr)
|
|||||||
wdunwedge(du);
|
wdunwedge(du);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(du->dk_dkunit >= 0) {
|
|
||||||
dk_busy |= 1 << du->dk_dkunit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA) {
|
if ((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA) {
|
||||||
wddma[du->dk_interface].wdd_dmaprep(du->dk_dmacookie,
|
wddma[du->dk_interface].wdd_dmaprep(du->dk_dmacookie,
|
||||||
@ -1041,16 +1021,6 @@ wdstart(int ctrlr)
|
|||||||
(void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE),
|
(void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE),
|
||||||
(count * DEV_BSIZE) / sizeof(short));
|
(count * DEV_BSIZE) / sizeof(short));
|
||||||
du->dk_bc -= DEV_BSIZE * count;
|
du->dk_bc -= DEV_BSIZE * count;
|
||||||
if (du->dk_dkunit >= 0) {
|
|
||||||
/*
|
|
||||||
* `wd's are blocks of 32 16-bit `word's according to
|
|
||||||
* iostat. dk_wds[] is the one disk i/o statistic that
|
|
||||||
* we can record correctly.
|
|
||||||
* XXX perhaps we shouldn't record words for failed
|
|
||||||
* transfers.
|
|
||||||
*/
|
|
||||||
dk_wds[du->dk_dkunit] += (count * DEV_BSIZE) >> 6;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interrupt routine for the controller. Acknowledge the interrupt, check for
|
/* Interrupt routine for the controller. Acknowledge the interrupt, check for
|
||||||
@ -1239,8 +1209,6 @@ wdintr(int unit)
|
|||||||
chk += sizeof(short);
|
chk += sizeof(short);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (du->dk_dkunit >= 0)
|
|
||||||
dk_wds[du->dk_dkunit] += chk >> 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* final cleanup on DMA */
|
/* final cleanup on DMA */
|
||||||
@ -1253,8 +1221,6 @@ wdintr(int unit)
|
|||||||
|
|
||||||
du->dk_bc -= iosize;
|
du->dk_bc -= iosize;
|
||||||
|
|
||||||
if (du->dk_dkunit >= 0)
|
|
||||||
dk_wds[du->dk_dkunit] += iosize >> 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
outt:
|
outt:
|
||||||
@ -1294,11 +1260,14 @@ done: ;
|
|||||||
bp->b_resid = bp->b_bcount - du->dk_skip * DEV_BSIZE;
|
bp->b_resid = bp->b_bcount - du->dk_skip * DEV_BSIZE;
|
||||||
wdutab[du->dk_lunit].b_active = 0;
|
wdutab[du->dk_lunit].b_active = 0;
|
||||||
du->dk_skip = 0;
|
du->dk_skip = 0;
|
||||||
biodone(bp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(du->dk_dkunit >= 0) {
|
/* Update device stats */
|
||||||
dk_busy &= ~(1 << du->dk_dkunit);
|
devstat_end_transaction(&du->dk_stats,
|
||||||
|
bp->b_bcount - bp->b_resid,
|
||||||
|
DEVSTAT_TAG_NONE,
|
||||||
|
(bp->b_flags & B_READ) ? DEVSTAT_READ : DEVSTAT_WRITE);
|
||||||
|
|
||||||
|
biodone(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* controller idle */
|
/* controller idle */
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: wfd.c,v 1.14 1998/07/30 15:16:05 bde Exp $
|
* $Id: wfd.c,v 1.15 1998/08/23 20:16:34 phk Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -43,6 +43,7 @@
|
|||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/diskslice.h>
|
#include <sys/diskslice.h>
|
||||||
#include <sys/cdio.h>
|
#include <sys/cdio.h>
|
||||||
@ -141,6 +142,8 @@ struct wfd {
|
|||||||
void *bdevs;
|
void *bdevs;
|
||||||
#endif
|
#endif
|
||||||
struct diskslices *dk_slices; /* virtual drives */
|
struct diskslices *dk_slices; /* virtual drives */
|
||||||
|
|
||||||
|
struct devstat device_stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wfd *wfdtab[NUNIT]; /* Drive info by unit number */
|
static struct wfd *wfdtab[NUNIT]; /* Drive info by unit number */
|
||||||
@ -263,6 +266,14 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
|
|||||||
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
|
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
|
||||||
"rwfd%d", t->lun);
|
"rwfd%d", t->lun);
|
||||||
#endif /* DEVFS */
|
#endif /* DEVFS */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Export the drive to the devstat interface.
|
||||||
|
*/
|
||||||
|
devstat_add_entry(&t->device_stats, "wfd",
|
||||||
|
wfdnlun, t->cap.sector_size,
|
||||||
|
DEVSTAT_NO_ORDERED_TAGS,
|
||||||
|
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,6 +498,9 @@ static void wfd_start (struct wfd *t)
|
|||||||
/* Unqueue the request. */
|
/* Unqueue the request. */
|
||||||
bufq_remove(&t->buf_queue, bp);
|
bufq_remove(&t->buf_queue, bp);
|
||||||
|
|
||||||
|
/* Tell devstat we are starting on the transaction */
|
||||||
|
devstat_start_transaction(&t->device_stats);
|
||||||
|
|
||||||
/* We have a buf, now we should make a command
|
/* We have a buf, now we should make a command
|
||||||
* First, translate the block to absolute and put it in terms of the
|
* First, translate the block to absolute and put it in terms of the
|
||||||
* logical blocksize of the device. */
|
* logical blocksize of the device. */
|
||||||
@ -574,6 +588,13 @@ static void wfd_done (struct wfd *t, struct buf *bp, int resid,
|
|||||||
*/
|
*/
|
||||||
if (((int)bp->b_driver1)-- <= 0) {
|
if (((int)bp->b_driver1)-- <= 0) {
|
||||||
bp->b_resid = (int)bp->b_driver2;
|
bp->b_resid = (int)bp->b_driver2;
|
||||||
|
|
||||||
|
/* Tell devstat we have finished with the transaction */
|
||||||
|
devstat_end_transaction(&t->device_stats,
|
||||||
|
bp->b_bcount - bp->b_resid,
|
||||||
|
DEVSTAT_TAG_NONE,
|
||||||
|
(bp->b_flags & B_READ) ? DEVSTAT_READ : DEVSTAT_WRITE);
|
||||||
|
|
||||||
biodone (bp);
|
biodone (bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
50
sys/isa/fd.c
50
sys/isa/fd.c
@ -43,7 +43,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
* 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 <machine/ioctl_fd.h>
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/syslog.h>
|
#include <sys/syslog.h>
|
||||||
#ifdef notyet
|
|
||||||
#include <sys/dkstat.h>
|
|
||||||
#endif
|
|
||||||
#include <i386/isa/isa.h>
|
#include <i386/isa/isa.h>
|
||||||
#include <i386/isa/isa_device.h>
|
#include <i386/isa/isa_device.h>
|
||||||
#include <i386/isa/fdreg.h>
|
#include <i386/isa/fdreg.h>
|
||||||
@ -174,11 +172,9 @@ static struct fd_data {
|
|||||||
#define FD_NO_TRACK -2
|
#define FD_NO_TRACK -2
|
||||||
int track; /* where we think the head is */
|
int track; /* where we think the head is */
|
||||||
int options; /* user configurable options, see ioctl_fd.h */
|
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 toffhandle;
|
||||||
struct callout_handle tohandle;
|
struct callout_handle tohandle;
|
||||||
|
struct devstat device_stats;
|
||||||
#ifdef DEVFS
|
#ifdef DEVFS
|
||||||
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
|
void *bdevs[1 + NUMDENS + MAXPARTITIONS];
|
||||||
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
|
void *cdevs[1 + NUMDENS + MAXPARTITIONS];
|
||||||
@ -793,18 +789,14 @@ fdattach(struct isa_device *dev)
|
|||||||
"rfd%d%c", fdu, 'a' + i);
|
"rfd%d%c", fdu, 'a' + i);
|
||||||
}
|
}
|
||||||
#endif /* DEVFS */
|
#endif /* DEVFS */
|
||||||
#ifdef notyet
|
/*
|
||||||
if (dk_ndrive < DK_NDRIVE) {
|
* Export the drive to the devstat interface.
|
||||||
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
|
*/
|
||||||
fd->dkunit = dk_ndrive++;
|
devstat_add_entry(&fd->device_stats, "fd",
|
||||||
/*
|
fdu, 512,
|
||||||
* XXX assume rate is FDC_500KBPS.
|
DEVSTAT_NO_ORDERED_TAGS,
|
||||||
*/
|
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_OTHER);
|
||||||
dk_wpms[dk_ndrive] = 500000 / 8 / 2;
|
|
||||||
} else {
|
|
||||||
fd->dkunit = -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
@ -1202,6 +1194,10 @@ fdstrategy(struct buf *bp)
|
|||||||
s = splbio();
|
s = splbio();
|
||||||
bufqdisksort(&fdc->head, bp);
|
bufqdisksort(&fdc->head, bp);
|
||||||
untimeout(fd_turnoff, (caddr_t)fdu, fd->toffhandle); /* a good idea */
|
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);
|
fdstart(fdcu);
|
||||||
splx(s);
|
splx(s);
|
||||||
return;
|
return;
|
||||||
@ -1210,7 +1206,6 @@ fdstrategy(struct buf *bp)
|
|||||||
biodone(bp);
|
biodone(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************\
|
/***************************************************************\
|
||||||
* fdstart *
|
* fdstart *
|
||||||
* We have just queued something.. if the controller is not busy *
|
* We have just queued something.. if the controller is not busy *
|
||||||
@ -1627,6 +1622,12 @@ fdstate(fdcu_t fdcu, fdc_p fdc)
|
|||||||
/* ALL DONE */
|
/* ALL DONE */
|
||||||
fd->skip = 0;
|
fd->skip = 0;
|
||||||
bufq_remove(&fdc->head, bp);
|
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);
|
biodone(bp);
|
||||||
fdc->fd = (fd_p) 0;
|
fdc->fd = (fd_p) 0;
|
||||||
fdc->fdu = -1;
|
fdc->fdu = -1;
|
||||||
@ -1743,6 +1744,8 @@ retrier(fdcu)
|
|||||||
struct subdev *sd;
|
struct subdev *sd;
|
||||||
fdc_p fdc = fdc_data + fdcu;
|
fdc_p fdc = fdc_data + fdcu;
|
||||||
register struct buf *bp;
|
register struct buf *bp;
|
||||||
|
struct fd_data *fd;
|
||||||
|
int fdu;
|
||||||
|
|
||||||
bp = bufq_first(&fdc->head);
|
bp = bufq_first(&fdc->head);
|
||||||
|
|
||||||
@ -1789,6 +1792,13 @@ retrier(fdcu)
|
|||||||
bp->b_error = EIO;
|
bp->b_error = EIO;
|
||||||
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
bp->b_resid += bp->b_bcount - fdc->fd->skip;
|
||||||
bufq_remove(&fdc->head, bp);
|
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;
|
fdc->fd->skip = 0;
|
||||||
biodone(bp);
|
biodone(bp);
|
||||||
fdc->state = FINDWORK;
|
fdc->state = FINDWORK;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: wfd.c,v 1.14 1998/07/30 15:16:05 bde Exp $
|
* $Id: wfd.c,v 1.15 1998/08/23 20:16:34 phk Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -43,6 +43,7 @@
|
|||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
#include <sys/devicestat.h>
|
||||||
#include <sys/disklabel.h>
|
#include <sys/disklabel.h>
|
||||||
#include <sys/diskslice.h>
|
#include <sys/diskslice.h>
|
||||||
#include <sys/cdio.h>
|
#include <sys/cdio.h>
|
||||||
@ -141,6 +142,8 @@ struct wfd {
|
|||||||
void *bdevs;
|
void *bdevs;
|
||||||
#endif
|
#endif
|
||||||
struct diskslices *dk_slices; /* virtual drives */
|
struct diskslices *dk_slices; /* virtual drives */
|
||||||
|
|
||||||
|
struct devstat device_stats;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wfd *wfdtab[NUNIT]; /* Drive info by unit number */
|
static struct wfd *wfdtab[NUNIT]; /* Drive info by unit number */
|
||||||
@ -263,6 +266,14 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
|
|||||||
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
|
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
|
||||||
"rwfd%d", t->lun);
|
"rwfd%d", t->lun);
|
||||||
#endif /* DEVFS */
|
#endif /* DEVFS */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Export the drive to the devstat interface.
|
||||||
|
*/
|
||||||
|
devstat_add_entry(&t->device_stats, "wfd",
|
||||||
|
wfdnlun, t->cap.sector_size,
|
||||||
|
DEVSTAT_NO_ORDERED_TAGS,
|
||||||
|
DEVSTAT_TYPE_FLOPPY | DEVSTAT_TYPE_IF_IDE);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,6 +498,9 @@ static void wfd_start (struct wfd *t)
|
|||||||
/* Unqueue the request. */
|
/* Unqueue the request. */
|
||||||
bufq_remove(&t->buf_queue, bp);
|
bufq_remove(&t->buf_queue, bp);
|
||||||
|
|
||||||
|
/* Tell devstat we are starting on the transaction */
|
||||||
|
devstat_start_transaction(&t->device_stats);
|
||||||
|
|
||||||
/* We have a buf, now we should make a command
|
/* We have a buf, now we should make a command
|
||||||
* First, translate the block to absolute and put it in terms of the
|
* First, translate the block to absolute and put it in terms of the
|
||||||
* logical blocksize of the device. */
|
* logical blocksize of the device. */
|
||||||
@ -574,6 +588,13 @@ static void wfd_done (struct wfd *t, struct buf *bp, int resid,
|
|||||||
*/
|
*/
|
||||||
if (((int)bp->b_driver1)-- <= 0) {
|
if (((int)bp->b_driver1)-- <= 0) {
|
||||||
bp->b_resid = (int)bp->b_driver2;
|
bp->b_resid = (int)bp->b_driver2;
|
||||||
|
|
||||||
|
/* Tell devstat we have finished with the transaction */
|
||||||
|
devstat_end_transaction(&t->device_stats,
|
||||||
|
bp->b_bcount - bp->b_resid,
|
||||||
|
DEVSTAT_TAG_NONE,
|
||||||
|
(bp->b_flags & B_READ) ? DEVSTAT_READ : DEVSTAT_WRITE);
|
||||||
|
|
||||||
biodone (bp);
|
biodone (bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user