mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 17:32:43 +00:00
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
This commit is contained in:
parent
b15443ba83
commit
6c0a2b9722
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=24641
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user