summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-04-04 22:12:55 +0000
committerjkh <jkh@FreeBSD.org>1997-04-04 22:12:55 +0000
commit65c0512f6f0908f55a5cc40ad7db9ae5aeb650b9 (patch)
treec599986140087f0674c0e0f6500b6e1103774150 /sys/scsi
parent1aefb8ae80064d515617534ba57f5859b3d3f308 (diff)
downloadFreeBSD-src-65c0512f6f0908f55a5cc40ad7db9ae5aeb650b9.zip
FreeBSD-src-65c0512f6f0908f55a5cc40ad7db9ae5aeb650b9.tar.gz
Implement dkstats for worm devices so they show up in iostat et al.
I got tired of not seeing my worm stats show up during a burn. :) [Joerg, I just stapled in 1MB/sec for a bogus xfer rate and left seek = 1, as suggested - I'm not going to dynamically calculate the xfer rate from a known device spectable, OK? :-)] Reviewed by: joerg
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/worm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c
index 82a8fa2..84e7f56 100644
--- a/sys/scsi/worm.c
+++ b/sys/scsi/worm.c
@@ -43,7 +43,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: worm.c,v 1.34 1997/03/23 06:33:55 bde Exp $
+ * $Id: worm.c,v 1.35 1997/03/24 11:25:04 bde Exp $
*/
#include "opt_bounce.h"
@@ -66,6 +66,7 @@
#include <scsi/scsi_disk.h>
#include <scsi/scsi_driver.h>
#include <scsi/scsi_worm.h>
+#include <sys/dkstat.h>
/* #include <scsi/scsi_cd.h> */ /* XXX a CD-R includes all CD functionality */
struct worm_quirks
@@ -90,6 +91,7 @@ struct worm_quirks
struct scsi_data
{
struct buf_queue_head buf_queue;
+ int dkunit; /* disk stats unit number */
u_int32_t n_blks; /* Number of blocks (0 for bogus) */
u_int32_t blk_size; /* Size of each blocks */
#ifdef DEVFS
@@ -203,6 +205,18 @@ struct worm_quirks worm_quirks[] = {
{0}
};
+static inline void
+worm_registerdev(int unit)
+{
+ if (dk_ndrive < DK_NDRIVE) {
+ sprintf(dk_names[dk_ndrive], "worm%d", unit);
+ dk_wpms[dk_ndrive] = (1*1024*1024/2); /* 1MB/sec XXX - fake! */
+ SCSI_DATA(&worm_switch, unit)->dkunit = dk_ndrive++;
+ } else {
+ SCSI_DATA(&worm_switch, unit)->dkunit = -1;
+ }
+}
+
static errval
worm_size(struct scsi_link *sc_link, int flags)
{
@@ -239,6 +253,7 @@ worm_size(struct scsi_link *sc_link, int flags)
static errval
wormattach(struct scsi_link *sc_link)
{
+ u_int32_t unit = sc_link->dev_unit;
#ifdef DEVFS
int mynor;
#endif
@@ -258,6 +273,7 @@ wormattach(struct scsi_link *sc_link)
devfs_add_devswf(&worm_cdevsw, mynor | SCSI_CONTROL_MASK,
DV_CHR, 0, 0, 0600, "rworm%d.ctl", mynor);
#endif
+ worm_registerdev(unit);
return 0;
}
@@ -351,6 +367,11 @@ wormstart(unit, flags)
100000,
bp,
flags | SCSI_NOSLEEP) == SUCCESSFULLY_QUEUED) {
+ if (worm->dkunit >= 0) { /* Cloned from od.c, possibly with same mistakes. :) */
+ dk_xfer[worm->dkunit]++;
+ dk_seek[worm->dkunit] = 1; /* single track */
+ dk_wds[worm->dkunit] += bp->b_bcount >> 6;
+ }
if ((bp->b_flags & B_READ) == B_WRITE)
worm->worm_flags |= WORMFL_WRITTEN;
} else {
OpenPOWER on IntegriCloud