Prefix iostat structure elements with io_

This commit is contained in:
blymn 2006-04-20 12:13:51 +00:00
parent 52d2a20915
commit 10df330c85
9 changed files with 104 additions and 102 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: tctrl.c,v 1.32 2006/04/14 13:09:05 blymn Exp $ */
/* $NetBSD: tctrl.c,v 1.33 2006/04/20 12:13:51 blymn Exp $ */
/*-
* Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.32 2006/04/14 13:09:05 blymn Exp $");
__KERNEL_RCSID(0, "$NetBSD: tctrl.c,v 1.33 2006/04/20 12:13:51 blymn Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1532,18 +1532,18 @@ tctrl_event_thread(void *v)
tsleep(&sc->sc_events, PWAIT, "probe_disk", hz);
}
printf("found %s\n", sd->sc_dev.dv_xname);
rcount = sd->sc_dk.dk_stats->rxfer;
wcount = sd->sc_dk.dk_stats->wxfer;
rcount = sd->sc_dk.dk_stats->io_rxfer;
wcount = sd->sc_dk.dk_stats->io_wxfer;
tctrl_read_event_status(sc);
while (1) {
tsleep(&sc->sc_events, PWAIT, "tctrl_event", ticks);
s = splhigh();
if ((rcount != sd->sc_dk.dk_stats->rxfer) ||
(wcount != sd->sc_dk.dk_stats->wxfer)) {
rcount = sd->sc_dk.dk_stats->rxfer;
wcount = sd->sc_dk.dk_stats->wxfer;
if ((rcount != sd->sc_dk.dk_stats->io_rxfer) ||
(wcount != sd->sc_dk.dk_stats->io_wxfer)) {
rcount = sd->sc_dk.dk_stats->io_rxfer;
wcount = sd->sc_dk.dk_stats->io_wxfer;
sc->sc_lcdwanted |= TS102_LCD_DISK_ACTIVE;
} else
sc->sc_lcdwanted &= ~TS102_LCD_DISK_ACTIVE;

View File

@ -1,4 +1,4 @@
/* $NetBSD: xbd.c,v 1.33 2006/04/15 17:54:12 matt Exp $ */
/* $NetBSD: xbd.c,v 1.34 2006/04/20 12:13:51 blymn Exp $ */
/*
*
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.33 2006/04/15 17:54:12 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: xbd.c,v 1.34 2006/04/20 12:13:51 blymn Exp $");
#include "xbd_hypervisor.h"
#include "rnd.h"
@ -1044,7 +1044,7 @@ xbd_detach(struct device *dv, int flags)
xs->sc_shutdown = 1;
/* And give it some time to settle if it's busy. */
if (xs->sc_dksc.sc_dkdev.dk_stats->busy > 0)
if (xs->sc_dksc.sc_dkdev.dk_stats->io_busy > 0)
tsleep(&xs, PWAIT, "xbdetach", hz);
/* locate the major number */

View File

@ -1,4 +1,4 @@
/* $NetBSD: st.c,v 1.189 2006/04/14 13:09:06 blymn Exp $ */
/* $NetBSD: st.c,v 1.190 2006/04/20 12:13:52 blymn Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.189 2006/04/14 13:09:06 blymn Exp $");
__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.190 2006/04/20 12:13:52 blymn Exp $");
#include "opt_scsi.h"
@ -413,7 +413,7 @@ stattach(struct device *parent, struct st_softc *st, void *aux)
}
st->stats = iostat_alloc(IOSTAT_TAPE);
st->stats->name = st->sc_dev.dv_xname;
st->stats->io_name = st->sc_dev.dv_xname;
#if NRND > 0
rnd_attach_source(&st->rnd_source, st->sc_dev.dv_xname,

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_disk.c,v 1.74 2006/04/14 13:09:06 blymn Exp $ */
/* $NetBSD: subr_disk.c,v 1.75 2006/04/20 12:13:53 blymn Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.74 2006/04/14 13:09:06 blymn Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.75 2006/04/20 12:13:53 blymn Exp $");
#include "opt_compat_netbsd.h"
@ -174,8 +174,8 @@ disk_find(char *name)
stat = iostat_find(name);
if ((stat != NULL) && (stat->type == IOSTAT_DISK))
return stat->parent;
if ((stat != NULL) && (stat->io_type == IOSTAT_DISK))
return stat->io_parent;
return (NULL);
}
@ -214,8 +214,8 @@ disk_attach0(struct disk *diskp)
* Set up the stats collection.
*/
diskp->dk_stats = iostat_alloc(IOSTAT_DISK);
diskp->dk_stats->parent = (void *) diskp;
diskp->dk_stats->name = diskp->dk_name;
diskp->dk_stats->io_parent = (void *) diskp;
diskp->dk_stats->io_name = diskp->dk_name;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_iostat.c,v 1.1 2006/04/14 13:17:20 blymn Exp $ */
/* $NetBSD: subr_iostat.c,v 1.2 2006/04/20 12:13:53 blymn Exp $ */
/* NetBSD: subr_disk.c,v 1.69 2005/05/29 22:24:15 christos Exp */
/*-
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.1 2006/04/14 13:17:20 blymn Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_iostat.c,v 1.2 2006/04/20 12:13:53 blymn Exp $");
#include "opt_compat_netbsd.h"
@ -123,8 +123,8 @@ iostat_find(char *name)
simple_lock(&iostatlist_slock);
for (iostatp = TAILQ_FIRST(&iostatlist); iostatp != NULL;
iostatp = TAILQ_NEXT(iostatp, link))
if (strcmp(iostatp->name, name) == 0) {
iostatp = TAILQ_NEXT(iostatp, io_link))
if (strcmp(iostatp->io_name, name) == 0) {
simple_unlock(&iostatlist_slock);
return (iostatp);
}
@ -148,27 +148,27 @@ io_stats *iostat_alloc(int32_t type)
panic("iostat_alloc: cannot allocate memory for stats "
"buffer");
stats->type = type;
stats->rxfer = 0;
stats->rbytes = 0;
stats->wxfer = 0;
stats->wbytes = 0;
stats->io_type = type;
stats->io_rxfer = 0;
stats->io_rbytes = 0;
stats->io_wxfer = 0;
stats->io_wbytes = 0;
/*
* Set the attached timestamp.
*/
s = splclock();
stats->attachtime = mono_time;
stats->io_attachtime = mono_time;
splx(s);
timerclear(&stats->time);
timerclear(&stats->timestamp);
timerclear(&stats->io_time);
timerclear(&stats->io_timestamp);
/*
* Link into the drivelist.
*/
simple_lock(&iostatlist_slock);
TAILQ_INSERT_TAIL(&iostatlist, stats, link);
TAILQ_INSERT_TAIL(&iostatlist, stats, io_link);
iostat_count++;
simple_unlock(&iostatlist_slock);
@ -188,7 +188,7 @@ iostat_free(struct io_stats *stats)
if (iostat_count == 0)
panic("iostat_free: iostat_count == 0");
simple_lock(&iostatlist_slock);
TAILQ_REMOVE(&iostatlist, stats, link);
TAILQ_REMOVE(&iostatlist, stats, io_link);
iostat_count--;
simple_unlock(&iostatlist_slock);
free(stats, M_DEVBUF);
@ -207,9 +207,9 @@ iostat_busy(struct io_stats *stats)
* XXX We'd like to use something as accurate as microtime(),
* but that doesn't depend on the system TOD clock.
*/
if (stats->busy++ == 0) {
if (stats->io_busy++ == 0) {
s = splclock();
stats->timestamp = mono_time;
stats->io_timestamp = mono_time;
splx(s);
}
}
@ -224,8 +224,8 @@ iostat_unbusy(struct io_stats *stats, long bcount, int read)
int s;
struct timeval dv_time, diff_time;
if (stats->busy-- == 0) {
printf("%s: busy < 0\n", stats->name);
if (stats->io_busy-- == 0) {
printf("%s: busy < 0\n", stats->io_name);
panic("iostat_unbusy");
}
@ -233,17 +233,17 @@ iostat_unbusy(struct io_stats *stats, long bcount, int read)
dv_time = mono_time;
splx(s);
timersub(&dv_time, &stats->timestamp, &diff_time);
timeradd(&stats->time, &diff_time, &stats->time);
timersub(&dv_time, &stats->io_timestamp, &diff_time);
timeradd(&stats->io_time, &diff_time, &stats->io_time);
stats->timestamp = dv_time;
stats->io_timestamp = dv_time;
if (bcount > 0) {
if (read) {
stats->rbytes += bcount;
stats->rxfer++;
stats->io_rbytes += bcount;
stats->io_rxfer++;
} else {
stats->wbytes += bcount;
stats->wxfer++;
stats->io_wbytes += bcount;
stats->io_wxfer++;
}
}
}
@ -255,7 +255,7 @@ iostat_unbusy(struct io_stats *stats, long bcount, int read)
void
iostat_seek(struct io_stats *stats)
{
stats->seek++;
stats->io_seek++;
}
static int
@ -292,20 +292,20 @@ iostati_getnames(int disk_only, char *oldp, size_t *oldlenp, const void *newp,
simple_lock(&iostatlist_slock);
for (stats = TAILQ_FIRST(&iostatlist); stats != NULL;
stats = TAILQ_NEXT(stats, link)) {
if ((disk_only == 1) && (stats->type != IOSTAT_DISK))
stats = TAILQ_NEXT(stats, io_link)) {
if ((disk_only == 1) && (stats->io_type != IOSTAT_DISK))
continue;
if (where == NULL)
needed += strlen(stats->name) + 1;
needed += strlen(stats->io_name) + 1;
else {
memset(bf, 0, sizeof(bf));
if (first) {
strncpy(bf, stats->name, sizeof(bf));
strncpy(bf, stats->io_name, sizeof(bf));
first = 0;
} else {
bf[0] = ' ';
strncpy(bf + 1, stats->name,
strncpy(bf + 1, stats->io_name,
sizeof(bf) - 1);
}
bf[IOSTATNAMELEN] = '\0';
@ -365,24 +365,24 @@ sysctl_hw_iostats(SYSCTLFN_ARGS)
*oldlenp = 0;
simple_lock(&iostatlist_slock);
TAILQ_FOREACH(stats, &iostatlist, link) {
TAILQ_FOREACH(stats, &iostatlist, io_link) {
if (left < tocopy)
break;
strncpy(sdrive.name, stats->name, sizeof(sdrive.name));
sdrive.xfer = stats->rxfer + stats->wxfer;
sdrive.rxfer = stats->rxfer;
sdrive.wxfer = stats->wxfer;
sdrive.seek = stats->seek;
sdrive.bytes = stats->rbytes + stats->wbytes;
sdrive.rbytes = stats->rbytes;
sdrive.wbytes = stats->wbytes;
sdrive.attachtime_sec = stats->attachtime.tv_sec;
sdrive.attachtime_usec = stats->attachtime.tv_usec;
sdrive.timestamp_sec = stats->timestamp.tv_sec;
sdrive.timestamp_usec = stats->timestamp.tv_usec;
sdrive.time_sec = stats->time.tv_sec;
sdrive.time_usec = stats->time.tv_usec;
sdrive.busy = stats->busy;
strncpy(sdrive.name, stats->io_name, sizeof(sdrive.name));
sdrive.xfer = stats->io_rxfer + stats->io_wxfer;
sdrive.rxfer = stats->io_rxfer;
sdrive.wxfer = stats->io_wxfer;
sdrive.seek = stats->io_seek;
sdrive.bytes = stats->io_rbytes + stats->io_wbytes;
sdrive.rbytes = stats->io_rbytes;
sdrive.wbytes = stats->io_wbytes;
sdrive.attachtime_sec = stats->io_attachtime.tv_sec;
sdrive.attachtime_usec = stats->io_attachtime.tv_usec;
sdrive.timestamp_sec = stats->io_timestamp.tv_sec;
sdrive.timestamp_usec = stats->io_timestamp.tv_usec;
sdrive.time_sec = stats->io_time.tv_sec;
sdrive.time_usec = stats->io_time.tv_usec;
sdrive.busy = stats->io_busy;
error = copyout(&sdrive, where, min(tocopy, sizeof(sdrive)));
if (error)

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vfsops.c,v 1.153 2006/04/14 13:09:06 blymn Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.154 2006/04/20 12:13:53 blymn Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.153 2006/04/14 13:09:06 blymn Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.154 2006/04/20 12:13:53 blymn Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -807,10 +807,12 @@ mountnfs(argp, mp, nam, pth, hst, vpp, l)
VOP_UNLOCK(*vpp, 0);
nmp->nm_stats = iostat_alloc(IOSTAT_NFS);
nmp->nm_stats->parent = nmp;
nmp->nm_stats->io_parent = nmp;
/* generate a ficticious drive name for the nfs mount */
MALLOC(nmp->nm_stats->name, char *, IOSTATNAMELEN, M_NFSMNT, M_WAITOK);
snprintf(nmp->nm_stats->name, IOSTATNAMELEN, "nfs%u", nfs_mount_count);
MALLOC(nmp->nm_stats->io_name, char *, IOSTATNAMELEN, M_NFSMNT,
M_WAITOK);
snprintf(nmp->nm_stats->io_name, IOSTATNAMELEN, "nfs%u",
nfs_mount_count);
nfs_mount_count++;
return (0);
@ -886,7 +888,7 @@ nfs_unmount(mp, mntflags, l)
* nfs_mount_count here for good reason - we may not be unmounting
* the last thing mounted.
*/
FREE(nmp->nm_stats->name, M_NFSMNT);
FREE(nmp->nm_stats->io_name, M_NFSMNT);
iostat_free(nmp->nm_stats);
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: iostat.h,v 1.1 2006/04/14 13:09:07 blymn Exp $ */
/* $NetBSD: iostat.h,v 1.2 2006/04/20 12:13:53 blymn Exp $ */
/*-
* Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
@ -83,19 +83,19 @@ struct io_sysctl {
struct io_stats
{
char *name; /* device name */
void *parent; /* pointer to what we are attached to */
int type; /* type of device the state belong to */
int busy; /* busy counter */
u_int64_t rxfer; /* total number of read transfers */
u_int64_t wxfer; /* total number of write transfers */
u_int64_t seek; /* total independent seek operations */
u_int64_t rbytes; /* total bytes read */
u_int64_t wbytes; /* total bytes written */
struct timeval attachtime; /* time disk was attached */
struct timeval timestamp; /* timestamp of last unbusy */
struct timeval time; /* total time spent busy */
TAILQ_ENTRY(io_stats) link;
char *io_name; /* device name */
void *io_parent; /* pointer to what we are attached to */
int io_type; /* type of device the state belong to */
int io_busy; /* busy counter */
u_int64_t io_rxfer; /* total number of read transfers */
u_int64_t io_wxfer; /* total number of write transfers */
u_int64_t io_seek; /* total independent seek operations */
u_int64_t io_rbytes; /* total bytes read */
u_int64_t io_wbytes; /* total bytes written */
struct timeval io_attachtime; /* time disk was attached */
struct timeval io_timestamp; /* timestamp of last unbusy */
struct timeval io_time; /* total time spent busy */
TAILQ_ENTRY(io_stats) io_link;
};
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: drvstats.c,v 1.1 2006/04/14 13:12:37 blymn Exp $ */
/* $NetBSD: drvstats.c,v 1.2 2006/04/20 12:13:53 blymn Exp $ */
/*
* Copyright (c) 1996 John M. Vinopal
@ -222,13 +222,13 @@ drvreadstats(void)
} else {
for (i = 0; i < ndrive; i++) {
deref_kptr(p, &cur_drive, sizeof(cur_drive));
cur.rxfer[i] = cur_drive.rxfer;
cur.wxfer[i] = cur_drive.wxfer;
cur.seek[i] = cur_drive.seek;
cur.rbytes[i] = cur_drive.rbytes;
cur.wbytes[i] = cur_drive.wbytes;
timerset(&(cur_drive.time), &(cur.time[i]));
p = cur_drive.link.tqe_next;
cur.rxfer[i] = cur_drive.io_rxfer;
cur.wxfer[i] = cur_drive.io_wxfer;
cur.seek[i] = cur_drive.io_seek;
cur.rbytes[i] = cur_drive.io_rbytes;
cur.wbytes[i] = cur_drive.io_wbytes;
timerset(&(cur_drive.io_time), &(cur.time[i]));
p = cur_drive.io_link.tqe_next;
}
deref_nl(X_TK_NIN, &cur.tk_nin, sizeof(cur.tk_nin));
@ -426,13 +426,13 @@ drvinit(int selected)
for (i = 0; i < ndrive; i++) {
char buf[10];
deref_kptr(p, &cur_drive, sizeof(cur_drive));
deref_kptr(cur_drive.name, buf, sizeof(buf));
deref_kptr(cur_drive.io_name, buf, sizeof(buf));
cur.name[i] = strdup(buf);
if (!cur.name[i])
err(1, "strdup");
cur.select[i] = selected;
p = cur_drive.link.tqe_next;
p = cur_drive.io_link.tqe_next;
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dklist.c,v 1.6 2006/04/14 13:20:48 blymn Exp $ */
/* $NetBSD: dklist.c,v 1.7 2006/04/20 12:13:53 blymn Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
#ifndef lint
#include <sys/cdefs.h>
__RCSID("$NetBSD: dklist.c,v 1.6 2006/04/14 13:20:48 blymn Exp $");
__RCSID("$NetBSD: dklist.c,v 1.7 2006/04/20 12:13:53 blymn Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -207,10 +207,10 @@ mlx_disk_add_all(void)
/* Try to add each disk to the list. */
for (i = 0; i < ndrives; i++) {
deref_kptr(kd, drv, &cur_drive, sizeof(cur_drive));
deref_kptr(kd, cur_drive.name, buf, sizeof(buf));
if (cur_drive.type == IOSTAT_DISK)
deref_kptr(kd, cur_drive.io_name, buf, sizeof(buf));
if (cur_drive.io_type == IOSTAT_DISK)
mlx_disk_add0(buf);
drv = TAILQ_NEXT(&cur_drive, link);
drv = TAILQ_NEXT(&cur_drive, io_link);
}
kvm_close(kd);