diff options
| author | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-03-08 08:01:31 +0000 |
|---|---|---|
| committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2003-03-08 08:01:31 +0000 |
| commit | 60794e0478b835c275eccb116cd177a789f87f56 (patch) | |
| tree | 040efa2f46ce483cf5b045724c67c81b1d43d147 | |
| parent | 74c69254e6161f609c5b4c3faca34b027753580b (diff) | |
Notes
56 files changed, 62 insertions, 250 deletions
diff --git a/sys/alpha/alpha/autoconf.c b/sys/alpha/alpha/autoconf.c index c6d9911a0f35..1b73b3396a04 100644 --- a/sys/alpha/alpha/autoconf.c +++ b/sys/alpha/alpha/autoconf.c @@ -41,7 +41,6 @@ #include <sys/mount.h> #include <sys/sysctl.h> #include <sys/bus.h> -#include <sys/devicestat.h> #include <sys/cons.h> #include <machine/md_var.h> diff --git a/sys/cam/cam_periph.h b/sys/cam/cam_periph.h index ac3225623122..9f271802d2be 100644 --- a/sys/cam/cam_periph.h +++ b/sys/cam/cam_periph.h @@ -35,6 +35,8 @@ #ifdef _KERNEL +struct devstat; + extern struct cam_periph *xpt_periph; extern struct periph_driver **periph_drivers; diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 0678380e1dc8..a272a3e819af 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -38,7 +38,6 @@ #include <sys/conf.h> #include <sys/fcntl.h> #include <sys/md5.h> -#include <sys/devicestat.h> #include <sys/interrupt.h> #include <sys/sbuf.h> diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 26e8cc37b9c1..d1dab0988d2a 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -116,7 +116,6 @@ struct disk_params { struct da_softc { struct bio_queue_head bio_queue; - struct devstat device_stats; SLIST_ENTRY(da_softc) links; LIST_HEAD(, ccb_hdr) pending_ccbs; da_state state; @@ -569,7 +568,7 @@ daopen(struct disk *dp) error = cam_periph_runccb(ccb, daerror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA, - &softc->device_stats); + softc->disk.d_devstat); if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(ccb->ccb_h.path, @@ -591,16 +590,8 @@ daopen(struct disk *dp) /* XXX: these are not actually "firmware" values, so they may be wrong */ softc->disk.d_fwsectors = softc->params.secs_per_track; softc->disk.d_fwheads = softc->params.heads; - - /* - * Check to see whether or not the blocksize is set yet. - * If it isn't, set it and then clear the blocksize - * unavailable flag for the device statistics. - */ - if ((softc->device_stats.flags & DEVSTAT_BS_UNAVAILABLE) != 0){ - softc->device_stats.block_size = softc->params.secsize; - softc->device_stats.flags &= ~DEVSTAT_BS_UNAVAILABLE; - } + softc->disk.d_devstat->block_size = softc->params.secsize; + softc->disk.d_devstat->flags &= ~DEVSTAT_BS_UNAVAILABLE; } if (error == 0) { @@ -647,7 +638,7 @@ daclose(struct disk *dp) cam_periph_runccb(ccb, /*error_routine*/NULL, /*cam_flags*/0, /*sense_flags*/SF_RETRY_UA, - &softc->device_stats); + softc->disk.d_devstat); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if ((ccb->ccb_h.status & CAM_STATUS_MASK) == @@ -688,7 +679,7 @@ daclose(struct disk *dp) * unavailable, since it could change when new media is * inserted. */ - softc->device_stats.flags |= DEVSTAT_BS_UNAVAILABLE; + softc->disk.d_devstat->flags |= DEVSTAT_BS_UNAVAILABLE; } softc->flags &= ~DA_FLAG_OPEN; @@ -976,7 +967,6 @@ dacleanup(struct cam_periph *periph) softc = (struct da_softc *)periph->softc; - devstat_remove_entry(&softc->device_stats); xpt_print_path(periph->path); printf("removing device entry\n"); disk_destroy(&softc->disk); @@ -1187,20 +1177,6 @@ daregister(struct cam_periph *periph, void *arg) splx(s); /* - * The DA driver supports a blocksize, but - * we don't know the blocksize until we do - * a read capacity. So, set a flag to - * indicate that the blocksize is - * unavailable right now. We'll clear the - * flag as soon as we've done a read capacity. - */ - devstat_add_entry(&softc->device_stats, "da", - periph->unit_number, 0, - DEVSTAT_BS_UNAVAILABLE, - SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI, - DEVSTAT_PRIORITY_DISK); - - /* * Register this media as a disk */ @@ -1276,8 +1252,6 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) bioq_remove(&softc->bio_queue, bp); - devstat_start_transaction(&softc->device_stats); - if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~DA_FLAG_NEED_OTAG; softc->ordered_tag_count++; @@ -1510,10 +1484,10 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); splx(oldspl); - if (softc->device_stats.busy_count == 0) + if (softc->disk.d_devstat->busy_count == 0) softc->flags |= DA_FLAG_WENT_IDLE; - biofinish(bp, &softc->device_stats, 0); + biodone(bp); break; } case DA_CCB_PROBE: @@ -1731,7 +1705,7 @@ daprevent(struct cam_periph *periph, int action) 5000); error = cam_periph_runccb(ccb, /*error_routine*/NULL, CAM_RETRY_SELTO, - SF_RETRY_UA, &softc->device_stats); + SF_RETRY_UA, softc->disk.d_devstat); if (error == 0) { if (action == PR_ALLOW) @@ -1790,7 +1764,7 @@ dasendorderedtag(void *arg) && ((softc->flags & DA_FLAG_WENT_IDLE) == 0)) { softc->flags |= DA_FLAG_NEED_OTAG; } - if (softc->device_stats.busy_count > 0) + if (softc->disk.d_devstat->busy_count > 0) softc->flags &= ~DA_FLAG_WENT_IDLE; softc->ordered_tag_count = 0; diff --git a/sys/cam/scsi/scsi_low.c b/sys/cam/scsi/scsi_low.c index afda1138e293..bcbcb376fb4f 100644 --- a/sys/cam/scsi/scsi_low.c +++ b/sys/cam/scsi/scsi_low.c @@ -75,7 +75,6 @@ #else #include <machine/clock.h> #endif -#include <sys/devicestat.h> #endif /* __FreeBSD__ */ #include <sys/buf.h> diff --git a/sys/cam/scsi/scsi_ses.c b/sys/cam/scsi/scsi_ses.c index fcdb4507513f..eb9a532a9bfc 100644 --- a/sys/cam/scsi/scsi_ses.c +++ b/sys/cam/scsi/scsi_ses.c @@ -34,7 +34,6 @@ #include <sys/fcntl.h> #include <sys/conf.h> #include <sys/errno.h> -#include <sys/devicestat.h> #include <machine/stdarg.h> #include <cam/cam.h> diff --git a/sys/contrib/dev/fla/fla.c b/sys/contrib/dev/fla/fla.c index 62949b544dad..c1ee68babe86 100644 --- a/sys/contrib/dev/fla/fla.c +++ b/sys/contrib/dev/fla/fla.c @@ -19,7 +19,6 @@ #include <sys/malloc.h> #include <sys/conf.h> #include <sys/disk.h> -#include <sys/devicestat.h> #include <sys/module.h> #include <machine/resource.h> @@ -80,7 +79,6 @@ static struct fla_s { unsigned nsect; struct doc2k_stat ds; struct bio_queue_head bio_queue; - struct devstat stats; struct disk disk; dev_t dev; } softc[8]; @@ -151,7 +149,6 @@ flastrategy(struct bio *bp) if (!bp) break; - devstat_start_transaction(&sc->stats); bp->bio_resid = bp->bio_bcount; unit = sc->unit; @@ -181,7 +178,7 @@ flastrategy(struct bio *bp) } else { bp->bio_resid = 0; } - biofinish(bp, &sc->stats, 0); + biodone(bp); } sc->busy = 0; @@ -259,11 +256,6 @@ flaattach (device_t dev) bioq_init(&sc->bio_queue); - devstat_add_entry(&softc[unit].stats, "fla", unit, DEV_BSIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_DISK); - sc->disk.d_open = flaopen; sc->disk.d_close = flaclose; sc->disk.d_strategy = flastrategy; diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 0eb036cf26aa..8a1679472d07 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -46,7 +46,6 @@ #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <sys/signalvar.h> #include <sys/time.h> diff --git a/sys/dev/aac/aac_cam.c b/sys/dev/aac/aac_cam.c index 37b583334074..d822dca96525 100644 --- a/sys/dev/aac/aac_cam.c +++ b/sys/dev/aac/aac_cam.c @@ -48,7 +48,6 @@ #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/md_var.h> diff --git a/sys/dev/aac/aac_debug.c b/sys/dev/aac/aac_debug.c index 36cfa4fd02f8..a72f9c9f9d51 100644 --- a/sys/dev/aac/aac_debug.c +++ b/sys/dev/aac/aac_debug.c @@ -40,7 +40,6 @@ #include <dev/aac/aac_compat.h> #include <sys/bus.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/resource.h> diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 635117515d8a..48288c1436f5 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -38,7 +38,6 @@ #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <vm/vm.h> @@ -175,7 +174,6 @@ aac_disk_strategy(struct bio *bp) /* pass the bio to the controller - it can work out who we are */ AAC_LOCK_ACQUIRE(&sc->ad_controller->aac_io_lock); - devstat_start_transaction(&sc->ad_stats); aac_submit_bio(bp); AAC_LOCK_RELEASE(&sc->ad_controller->aac_io_lock); @@ -282,7 +280,6 @@ aac_biodone(struct bio *bp) sc = (struct aac_disk *)bp->bio_disk->d_drv1; - devstat_end_transaction_bio(&sc->ad_stats, bp); if (bp->bio_flags & BIO_ERROR) disk_err(bp, "hard error", -1, 1); @@ -340,11 +337,6 @@ aac_disk_attach(device_t dev) sc->ad_size / ((1024 * 1024) / AAC_BLOCK_SIZE), sc->ad_size); - devstat_add_entry(&sc->ad_stats, "aacd", device_get_unit(dev), - AAC_BLOCK_SIZE, DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_ARRAY); - /* attach a generic disk device to ourselves */ sc->unit = device_get_unit(dev); sc->ad_disk.d_drv1 = sc; @@ -378,7 +370,6 @@ aac_disk_detach(device_t dev) if (sc->ad_flags & AAC_DISK_OPEN) return(EBUSY); - devstat_remove_entry(&sc->ad_stats); disk_destroy(&sc->ad_disk); return(0); diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c index 1a4545f81fe3..85fed9d7d89a 100644 --- a/sys/dev/aac/aac_pci.c +++ b/sys/dev/aac/aac_pci.c @@ -42,7 +42,6 @@ #include <sys/bio.h> #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/bus_memio.h> diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index 0125ec78783a..7ee8dc6d7ba2 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -124,7 +124,6 @@ struct aac_disk struct aac_softc *ad_controller; struct aac_container *ad_container; struct disk ad_disk; - struct devstat ad_stats; int ad_flags; #define AAC_DISK_OPEN (1<<0) int ad_cylinders; diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 3b58af592d71..170ff988c552 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -68,7 +68,6 @@ #include <dev/amr/amr_compat.h> #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <sys/stat.h> diff --git a/sys/dev/amr/amr_cam.c b/sys/dev/amr/amr_cam.c index 603a751e6591..1c8f6b6a74db 100644 --- a/sys/dev/amr/amr_cam.c +++ b/sys/dev/amr/amr_cam.c @@ -64,7 +64,6 @@ #include <dev/amr/amr_compat.h> #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <sys/stat.h> diff --git a/sys/dev/amr/amr_compat.h b/sys/dev/amr/amr_compat.h index 9bd5dc8248e8..33a09f0eebbe 100644 --- a/sys/dev/amr/amr_compat.h +++ b/sys/dev/amr/amr_compat.h @@ -91,7 +91,7 @@ #else # include <sys/bio.h> # define BIO_IS_READ(x) ((x)->bio_cmd == BIO_READ) -# define AMR_BIO_FINISH(x) biofinish(x, &sc->amrd_stats, 0) +# define AMR_BIO_FINISH(x) biodone(x) #endif /************************************************************************ diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index 2960bda69201..4266f15554c6 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -68,7 +68,6 @@ #include <dev/amr/amr_compat.h> #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/bus.h> @@ -161,7 +160,6 @@ amrd_strategy(struct bio *bio) goto bad; } - devstat_start_transaction(&sc->amrd_stats); amr_submit_bio(sc->amrd_controller, bio); return; @@ -180,7 +178,6 @@ void amrd_intr(void *data) { struct bio *bio = (struct bio *)data; - struct amrd_softc *sc = (struct amrd_softc *)bio->bio_disk->d_drv1; debug_called(2); @@ -223,11 +220,6 @@ amrd_attach(device_t dev) sc->amrd_drive->al_size, sc->amrd_drive->al_properties & AMR_DRV_RAID_MASK, amr_describe_code(amr_table_drvstate, AMR_DRV_CURSTATE(sc->amrd_drive->al_state))); - devstat_add_entry(&sc->amrd_stats, "amrd", sc->amrd_unit, AMR_BLKSIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_ARRAY); - sc->amrd_disk.d_drv1 = sc; sc->amrd_disk.d_maxsize = (AMR_NSEG - 1) * PAGE_SIZE; sc->amrd_disk.d_open = amrd_open; @@ -251,7 +243,6 @@ amrd_detach(device_t dev) if (sc->amrd_disk.d_flags & DISKFLAG_OPEN) return(EBUSY); - devstat_remove_entry(&sc->amrd_stats); #ifdef FREEBSD_4 if (--disks_registered == 0) cdevsw_remove(&amrddisk_cdevsw); diff --git a/sys/dev/amr/amr_pci.c b/sys/dev/amr/amr_pci.c index f870d4cbbc5c..caffc5dd0aaf 100644 --- a/sys/dev/amr/amr_pci.c +++ b/sys/dev/amr/amr_pci.c @@ -63,7 +63,6 @@ #include <dev/amr/amr_compat.h> #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/bus_memio.h> diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index bc6f4aef3221..a9bca40588b7 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -253,7 +253,6 @@ struct amrd_softc struct amr_softc *amrd_controller; struct amr_logdrive *amrd_drive; struct disk amrd_disk; - struct devstat amrd_stats; int amrd_unit; }; diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index fae76a5ddc74..657a7c7c1589 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -39,7 +39,6 @@ #include <sys/bus.h> #include <sys/bio.h> #include <sys/malloc.h> -#include <sys/devicestat.h> #include <sys/stdint.h> #include <sys/sysctl.h> #include <machine/stdarg.h> diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 1428132087a2..9193c6598234 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -38,7 +38,6 @@ #include <sys/bus.h> #include <sys/conf.h> #include <sys/disk.h> -#include <sys/devicestat.h> #include <sys/cons.h> #include <sys/sysctl.h> #include <vm/vm.h> @@ -185,11 +184,6 @@ ad_attach(struct ata_device *atadev) #endif ATA_UNLOCK_CH(atadev->channel); - devstat_add_entry(&adp->stats, "ad", adp->lun, DEV_BSIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE, - DEVSTAT_PRIORITY_DISK); - adp->disk.d_open = adopen; adp->disk.d_close = adclose; adp->disk.d_strategy = adstrategy; @@ -242,7 +236,6 @@ ad_detach(struct ata_device *atadev, int flush) /* get rid of flush XXX SOS */ biofinish(bp, NULL, ENXIO); } disk_destroy(&adp->disk); - devstat_remove_entry(&adp->stats); if (flush) { if (ata_command(atadev, ATA_C_FLUSHCACHE, 0, 0, 0, ATA_WAIT_READY)) ata_prtdev(atadev, "flushing cache on detach failed\n"); @@ -437,8 +430,6 @@ ad_transfer(struct ad_request *request) adp->device->flags |= ATA_D_USE_CHS; } - devstat_start_transaction(&adp->stats); - /* does this drive & transfer work with DMA ? */ request->flags &= ~ADR_F_DMA_USED; if (adp->device->mode >= ATA_DMA && @@ -546,7 +537,7 @@ transfer_failed: request->bp->bio_error = EIO; request->bp->bio_flags |= BIO_ERROR; request->bp->bio_resid = request->bytecount; - biofinish(request->bp, &adp->stats, 0); + biodone(request->bp); ad_free(request); } ata_reinit(adp->device->channel); @@ -660,7 +651,7 @@ ad_interrupt(struct ad_request *request) request->bp->bio_resid = request->bytecount; - biofinish(request->bp, &adp->stats, 0); + biodone(request->bp); ad_free(request); adp->outstanding--; @@ -856,7 +847,7 @@ ad_timeout(struct ad_request *request) /* retries all used up, return error */ request->bp->bio_error = EIO; request->bp->bio_flags |= BIO_ERROR; - biofinish(request->bp, &adp->stats, 0); + biodone(request->bp); ad_free(request); } ata_reinit(adp->device->channel); diff --git a/sys/dev/ata/ata-disk.h b/sys/dev/ata/ata-disk.h index 505690e106fe..f6809275b568 100644 --- a/sys/dev/ata/ata-disk.h +++ b/sys/dev/ata/ata-disk.h @@ -71,7 +71,6 @@ struct ad_softc { struct ad_request *tags[32]; /* tag array of requests */ int outstanding; /* tags not serviced yet */ struct bio_queue_head queue; /* head of request queue */ - struct devstat stats; /* devstat entry */ struct disk disk; /* disklabel/slice stuff */ }; diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index e5f5b6a1c55c..4f6f0e78d474 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -39,7 +39,6 @@ #include <sys/bus.h> #include <sys/conf.h> #include <sys/disk.h> -#include <sys/devicestat.h> #include <sys/cons.h> #include <sys/unistd.h> #include <sys/kthread.h> diff --git a/sys/dev/ata/atapi-cam.c b/sys/dev/ata/atapi-cam.c index 0d703c2ea95e..81c10fc94a93 100644 --- a/sys/dev/ata/atapi-cam.c +++ b/sys/dev/ata/atapi-cam.c @@ -31,7 +31,6 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/bus.h> -#include <sys/devicestat.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/ata.h> diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index e4f6cb82b674..0da55dda4ac6 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -37,7 +37,6 @@ #include <sys/bus.h> #include <sys/conf.h> #include <sys/disk.h> -#include <sys/devicestat.h> #include <sys/cdio.h> #include <machine/bus.h> #include <dev/ata/ata-all.h> @@ -83,10 +82,6 @@ afdattach(struct ata_device *atadev) return 0; } - devstat_add_entry(&fdp->stats, "afd", fdp->lun, DEV_BSIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE, - DEVSTAT_PRIORITY_WFD); fdp->disk.d_open = afdopen; fdp->disk.d_close = afdclose; #ifdef notyet @@ -115,7 +110,6 @@ afddetach(struct ata_device *atadev) biofinish(bp, NULL, ENXIO); } disk_destroy(&fdp->disk); - devstat_remove_entry(&fdp->stats); ata_free_name(atadev); ata_free_lun(&afd_lun_map, fdp->lun); free(fdp, M_AFD); @@ -334,8 +328,6 @@ afd_start(struct ata_device *atadev) ccb[7] = count>>8; ccb[8] = count; - devstat_start_transaction(&fdp->stats); - atapi_queue_cmd(fdp->device, ccb, data_ptr, count * fdp->cap.sector_size, (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); @@ -345,7 +337,6 @@ static int afd_done(struct atapi_request *request) { struct bio *bp = request->driver; - struct afd_softc *fdp = request->device->driver; if (request->error || (bp->bio_flags & BIO_ERROR)) { bp->bio_error = request->error; @@ -353,7 +344,7 @@ afd_done(struct atapi_request *request) } else bp->bio_resid = bp->bio_bcount - request->donecount; - biofinish(bp, &fdp->stats, 0); + biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-fd.h b/sys/dev/ata/atapi-fd.h index dc38fe37aac2..89794093d549 100644 --- a/sys/dev/ata/atapi-fd.h +++ b/sys/dev/ata/atapi-fd.h @@ -74,6 +74,5 @@ struct afd_softc { struct bio_queue_head queue; /* queue of i/o requests */ struct afd_cappage cap; /* capabilities page info */ struct disk disk; /* virtual drives */ - struct devstat stats; }; diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 3abc28f6225f..b97324615a39 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -66,7 +66,6 @@ #include <sys/stdint.h> #include <sys/sysctl.h> #include <sys/disk.h> -#include <sys/devicestat.h> #include <sys/fcntl.h> #include <sys/vnode.h> @@ -389,14 +388,6 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) ccg->ccg_nsectors = 1024 * 1024 / ccg->ccg_secsize; ccg->ccg_ncylinders = cs->sc_size / ccg->ccg_nsectors; - /* - * Add a devstat entry for this device. - */ - devstat_add_entry(&cs->device_stats, "ccd", cs->sc_unit, - ccg->ccg_secsize, DEVSTAT_ALL_SUPPORTED, - DEVSTAT_TYPE_STORARRAY |DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_ARRAY); - cs->sc_flags |= CCDF_INITED; cs->sc_cflags = cs->sc_flags; /* So we can find out later... */ return (0); @@ -574,10 +565,6 @@ ccdstart(struct ccd_s *cs, struct bio *bp) daddr_t bn; int err; - - /* Record the transaction start */ - devstat_start_transaction(&cs->device_stats); - /* * Translate the partition-relative block number to an absolute. */ @@ -909,7 +896,7 @@ ccdiodone(struct bio *ibp) if (bp->bio_resid == 0) { if (bp->bio_flags & BIO_ERROR) bp->bio_resid = bp->bio_bcount; - biofinish(bp, &cs->device_stats, 0); + biodone(bp); } } @@ -1180,9 +1167,6 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) free(cs->sc_itable, M_CCD); free(cs->sc_vpp, M_CCD); - /* And remove the devstat entry. */ - devstat_remove_entry(&cs->device_stats); - /* This must be atomic. */ ccdunlock(cs); ccddestroy(cs); diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c index 5b4116224c4c..4cf62719cbbf 100644 --- a/sys/dev/ciss/ciss.c +++ b/sys/dev/ciss/ciss.c @@ -74,7 +74,6 @@ #include <sys/kernel.h> #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/stat.h> #include <sys/stdint.h> diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 8d9f3062af86..be9193a795a0 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -42,7 +42,6 @@ #include <sys/sysctl.h> #include <machine/bus.h> #include <sys/malloc.h> -#include <sys/devicestat.h> /* for struct devstat */ #include <cam/cam.h> diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index 2f725b16809e..464ad8731e8a 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -46,7 +46,6 @@ #include <sys/bio.h> #include <sys/bus.h> -#include <sys/devicestat.h> #include <sys/conf.h> #include <sys/disk.h> diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c index c7cc93eafabe..7efb8deceb68 100644 --- a/sys/dev/ida/ida_disk.c +++ b/sys/dev/ida/ida_disk.c @@ -38,7 +38,6 @@ #include <sys/bus.h> #include <sys/conf.h> #include <sys/cons.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/bus_memio.h> @@ -105,7 +104,6 @@ idad_strategy(struct bio *bp) } s = splbio(); - devstat_start_transaction(&drv->stats); ida_submit_buf(drv->controller, bp); splx(s); return; @@ -156,7 +154,7 @@ idad_intr(struct bio *bp) else bp->bio_resid = 0; - biofinish(bp, &drv->stats, 0); + biodone(bp); } static int @@ -202,11 +200,6 @@ idad_attach(device_t dev) drv->secperunit / ((1024 * 1024) / drv->secsize), drv->secperunit, drv->secsize); - devstat_add_entry(&drv->stats, "idad", drv->unit, drv->secsize, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_STORARRAY| DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_ARRAY); - drv->disk.d_strategy = idad_strategy; drv->disk.d_name = "idad"; drv->disk.d_dump = idad_dump; @@ -227,7 +220,6 @@ idad_detach(device_t dev) struct idad_softc *drv; drv = (struct idad_softc *)device_get_softc(dev); - devstat_remove_entry(&drv->stats); disk_destroy(&drv->disk); return (0); } diff --git a/sys/dev/ida/ida_eisa.c b/sys/dev/ida/ida_eisa.c index c041fe27ed8e..eca47224cdb2 100644 --- a/sys/dev/ida/ida_eisa.c +++ b/sys/dev/ida/ida_eisa.c @@ -33,7 +33,6 @@ #include <sys/bus.h> #include <sys/bio.h> -#include <sys/devicestat.h> #include <sys/conf.h> #include <sys/disk.h> diff --git a/sys/dev/ida/ida_pci.c b/sys/dev/ida/ida_pci.c index 00f1bc7d1a10..f7194a489045 100644 --- a/sys/dev/ida/ida_pci.c +++ b/sys/dev/ida/ida_pci.c @@ -32,7 +32,6 @@ #include <sys/bio.h> #include <sys/bus.h> -#include <sys/devicestat.h> #include <sys/conf.h> #include <sys/disk.h> diff --git a/sys/dev/ida/idavar.h b/sys/dev/ida/idavar.h index c11438ee8ed0..4d5a9d68e0d6 100644 --- a/sys/dev/ida/idavar.h +++ b/sys/dev/ida/idavar.h @@ -170,7 +170,6 @@ struct idad_softc { device_t dev; struct ida_softc *controller; struct disk disk; - struct devstat stats; int drive; /* per controller */ int unit; /* global */ int cylinders; diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 7b754cba3313..232eba8b6828 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -64,7 +64,6 @@ #include <sys/systm.h> #include <sys/bio.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <sys/fcntl.h> #include <sys/kernel.h> @@ -143,7 +142,6 @@ struct indir { struct md_s { int unit; LIST_ENTRY(md_s) list; - struct devstat stats; struct bio_queue_head bio_queue; struct mtx queue_mtx; struct disk disk; @@ -594,15 +592,12 @@ md_kthread(void *arg) switch (sc->type) { case MD_MALLOC: - devstat_start_transaction(&sc->stats); error = mdstart_malloc(sc, bp); break; case MD_PRELOAD: - devstat_start_transaction(&sc->stats); error = mdstart_preload(sc, bp); break; case MD_VNODE: - devstat_start_transaction(&sc->stats); error = mdstart_vnode(sc, bp); break; case MD_SWAP: @@ -672,11 +667,6 @@ static void mdinit(struct md_s *sc) { - devstat_add_entry(&sc->stats, MD_NAME, sc->unit, sc->secsize, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_OTHER); - { struct g_geom *gp; struct g_provider *pp; @@ -694,7 +684,6 @@ mdinit(struct md_s *sc) g_error_provider(pp, 0); g_topology_unlock(); PICKUP_GIANT(); - } } /* @@ -909,15 +898,12 @@ mddestroy(struct md_s *sc, struct thread *td) GIANT_REQUIRED; mtx_destroy(&sc->queue_mtx); - devstat_remove_entry(&sc->stats); - { if (sc->gp) { sc->gp->flags |= G_GEOM_WITHER; sc->gp->softc = NULL; } if (sc->pp) g_orphan_provider(sc->pp, ENXIO); - } sc->flags |= MD_SHUTDOWN; wakeup(sc); while (sc->procp != NULL) diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index df8c03d8a92a..d8841de676ca 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -37,7 +37,6 @@ #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <sys/stat.h> diff --git a/sys/dev/mlx/mlx_compat.h b/sys/dev/mlx/mlx_compat.h index aa69ba60f8ab..7160c3d1639b 100644 --- a/sys/dev/mlx/mlx_compat.h +++ b/sys/dev/mlx/mlx_compat.h @@ -71,7 +71,7 @@ typedef struct bio_queue_head mlx_bioq; # define MLX_BIO_HAS_ERROR(bp) ((bp)->bio_flags & BIO_ERROR) # define MLX_BIO_RESID(bp) (bp)->bio_resid # define MLX_BIO_DONE(bp) biodone(bp) /* XXX nice to integrate bio_finish here */ -# define MLX_BIO_STATS_START(bp) devstat_start_transaction(&((struct mlxd_softc *)MLX_BIO_SOFTC(bp))->mlxd_stats) -# define MLX_BIO_STATS_END(bp) devstat_end_transaction_bio(&((struct mlxd_softc *)MLX_BIO_SOFTC(bp))->mlxd_stats, bp) +# define MLX_BIO_STATS_START(bp) +# define MLX_BIO_STATS_END(bp) #endif diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c index f660924883c5..0b8664fdee9c 100644 --- a/sys/dev/mlx/mlx_disk.c +++ b/sys/dev/mlx/mlx_disk.c @@ -37,7 +37,6 @@ #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/bus.h> @@ -217,11 +216,6 @@ mlxd_attach(device_t dev) sc->mlxd_drive->ms_size / ((1024 * 1024) / MLX_BLKSIZE), sc->mlxd_drive->ms_size, sc->mlxd_drive->ms_raidlevel, state); - devstat_add_entry(&sc->mlxd_stats, "mlxd", sc->mlxd_unit, MLX_BLKSIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_ARRAY); - sc->mlxd_disk.d_open = mlxd_open; sc->mlxd_disk.d_close = mlxd_close; sc->mlxd_disk.d_ioctl = mlxd_ioctl; @@ -257,7 +251,6 @@ mlxd_detach(device_t dev) debug_called(1); - devstat_remove_entry(&sc->mlxd_stats); disk_destroy(&sc->mlxd_disk); return(0); diff --git a/sys/dev/mlx/mlx_pci.c b/sys/dev/mlx/mlx_pci.c index 741c68209415..4a2124698805 100644 --- a/sys/dev/mlx/mlx_pci.c +++ b/sys/dev/mlx/mlx_pci.c @@ -32,7 +32,6 @@ #include <sys/bus.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <machine/bus_memio.h> diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h index e8924ef1e6de..d2e66d9b8d17 100644 --- a/sys/dev/mlx/mlxvar.h +++ b/sys/dev/mlx/mlxvar.h @@ -228,7 +228,6 @@ struct mlxd_softc struct mlx_softc *mlxd_controller; struct mlx_sysdrive *mlxd_drive; struct disk mlxd_disk; - struct devstat mlxd_stats; int mlxd_unit; int mlxd_flags; #define MLXD_OPEN (1<<0) /* drive is open (can't shut down) */ diff --git a/sys/dev/mly/mly.c b/sys/dev/mly/mly.c index 9a0edc46da5b..cdf1943a4f57 100644 --- a/sys/dev/mly/mly.c +++ b/sys/dev/mly/mly.c @@ -34,7 +34,6 @@ #include <sys/bus.h> #include <sys/conf.h> #include <sys/ctype.h> -#include <sys/devicestat.h> #include <sys/ioccom.h> #include <sys/stat.h> diff --git a/sys/dev/ofw/ofw_disk.c b/sys/dev/ofw/ofw_disk.c index 94695bd179da..0a3bfc1fc714 100644 --- a/sys/dev/ofw/ofw_disk.c +++ b/sys/dev/ofw/ofw_disk.c @@ -130,7 +130,7 @@ ofwd_strategy(struct bio *bp) biofinish(bp, NULL, EIO); /* XXX: probably not an error */ return; } - biofinish(bp, NULL, 0); + biodone(bp); return; } diff --git a/sys/dev/ppbus/vpo.c b/sys/dev/ppbus/vpo.c index ad83e2f83270..e76d14b60a74 100644 --- a/sys/dev/ppbus/vpo.c +++ b/sys/dev/ppbus/vpo.c @@ -31,8 +31,6 @@ #include <sys/module.h> #include <sys/bus.h> #include <sys/malloc.h> -#include <sys/devicestat.h> /* for struct devstat */ - #include <cam/cam.h> #include <cam/cam_ccb.h> diff --git a/sys/dev/pst/pst-raid.c b/sys/dev/pst/pst-raid.c index 1bd7a95ed734..9e02aac6a9e5 100644 --- a/sys/dev/pst/pst-raid.c +++ b/sys/dev/pst/pst-raid.c @@ -36,7 +36,6 @@ #include <sys/bio.h> #include <sys/conf.h> #include <sys/disk.h> -#include <sys/devicestat.h> #include <sys/eventhandler.h> #include <sys/malloc.h> #include <sys/lock.h> @@ -56,7 +55,6 @@ struct pst_softc { struct iop_softc *iop; struct i2o_lct_entry *lct; struct i2o_bsa_device *info; - struct devstat stats; struct disk disk; struct bio_queue_head queue; struct mtx mtx; @@ -164,11 +162,6 @@ pst_attach(device_t dev) psc->disk.d_fwsectors = 63; psc->disk.d_fwheads = 255; - devstat_add_entry(&psc->stats, "pst", lun, psc->info->block_size, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE, - DEVSTAT_PRIORITY_DISK); - printf("pst%d: %lluMB <%.40s> [%lld/%d/%d] on %.16s\n", lun, (unsigned long long)psc->info->capacity / (1024 * 1024), name, psc->info->capacity/(512*255*63), 255, 63, @@ -238,9 +231,8 @@ pst_start(struct pst_softc *psc) request->timeout_handle = timeout((timeout_t*)pst_timeout, request, 10 * hz); bioq_remove(&psc->queue, bp); - devstat_start_transaction(&psc->stats); if (pst_rw(request)) { - biofinish(request->bp, &psc->stats, EIO); + biofinish(request->bp, NULL, EIO); iop_free_mfa(request->psc->iop, request->mfa); psc->outstanding--; free(request, M_PSTRAID); @@ -258,7 +250,7 @@ pst_done(struct iop_softc *sc, u_int32_t mfa, struct i2o_single_reply *reply) untimeout((timeout_t *)pst_timeout, request, request->timeout_handle); request->bp->bio_resid = request->bp->bio_bcount - reply->donecount; - biofinish(request->bp, &psc->stats, reply->status ? EIO : 0); + biofinish(request->bp, NULL, reply->status ? EIO : 0); free(request, M_PSTRAID); mtx_lock(&psc->mtx); psc->iop->reg->oqueue = mfa; @@ -276,7 +268,7 @@ pst_timeout(struct pst_request *request) iop_free_mfa(request->psc->iop, request->mfa); if ((request->mfa = iop_get_mfa(request->psc->iop)) == 0xffffffff) { printf("pst: timeout no mfa possible\n"); - biofinish(request->bp, &request->psc->stats, EIO); + biofinish(request->bp, NULL, EIO); request->psc->outstanding--; mtx_unlock(&request->psc->mtx); return; @@ -288,7 +280,7 @@ pst_timeout(struct pst_request *request) timeout((timeout_t*)pst_timeout, request, 10 * hz); if (pst_rw(request)) { iop_free_mfa(request->psc->iop, request->mfa); - biofinish(request->bp, &request->psc->stats, EIO); + biofinish(request->bp, NULL, EIO); request->psc->outstanding--; } mtx_unlock(&request->psc->mtx); diff --git a/sys/dev/raidframe/rf_freebsdkintf.c b/sys/dev/raidframe/rf_freebsdkintf.c index 6e1f407b6e19..98374c9f91a2 100644 --- a/sys/dev/raidframe/rf_freebsdkintf.c +++ b/sys/dev/raidframe/rf_freebsdkintf.c @@ -161,7 +161,6 @@ #include <sys/lock.h> #include <sys/reboot.h> #include <sys/module.h> -#include <sys/devicestat.h> #include <vm/uma.h> #include "opt_raid.h" @@ -257,7 +256,6 @@ struct raid_softc { uma_zone_t sc_cbufpool; /* component buffer pool */ RF_Raid_t *raidPtr; /* Raid information struct */ struct bio_queue_head bio_queue; /* used for the device queue */ - struct devstat device_stats; /* devstat gathering */ }; /* sc_flags */ #define RAIDF_OPEN 0x01 /* unit has been initialized */ @@ -601,8 +599,6 @@ out: retcode = rf_Shutdown(sc->raidPtr); RF_THREADGROUP_WAIT_STOP(&sc->raidPtr->engine_tg); - devstat_remove_entry(&sc->device_stats); - disk_destroy(&sc->sc_disk); raidunlock(sc); @@ -1290,11 +1286,6 @@ raidinit(raidPtr) disk_create(raidPtr->raidid, &sc->sc_disk, 0, NULL, NULL); raidPtr->sc = sc; - /* Register with devstat */ - devstat_add_entry(&sc->device_stats, "raid", raidPtr->raidid, 0, - DEVSTAT_NO_BLOCKSIZE | DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_ARRAY); - return (sc); } @@ -1435,8 +1426,6 @@ raidstart(raidPtr) */ do_async = 1; - devstat_start_transaction(&sc->device_stats); - /* XXX we're still at splbio() here... do we *really* need to be? */ @@ -3040,8 +3029,6 @@ rf_disk_unbusy(desc) sc = desc->raidPtr->sc; bp = (struct bio *)desc->bp; - - devstat_end_transaction_bio(&sc->device_stats, bp); } /* diff --git a/sys/dev/twe/twe_compat.h b/sys/dev/twe/twe_compat.h index 3d104340b98e..7d2f9c710f11 100644 --- a/sys/dev/twe/twe_compat.h +++ b/sys/dev/twe/twe_compat.h @@ -171,8 +171,8 @@ typedef struct bio_queue_head twe_bioq; # define TWE_BIO_HAS_ERROR(bp) ((bp)->bio_flags & BIO_ERROR) # define TWE_BIO_RESID(bp) (bp)->bio_resid # define TWE_BIO_DONE(bp) biodone(bp) -# define TWE_BIO_STATS_START(bp) devstat_start_transaction(&((struct twed_softc *)TWE_BIO_SOFTC(bp))->twed_stats) -# define TWE_BIO_STATS_END(bp) devstat_end_transaction_bio(&((struct twed_softc *)TWE_BIO_SOFTC(bp))->twed_stats, bp) +# define TWE_BIO_STATS_START(bp) +# define TWE_BIO_STATS_END(bp) #endif #endif /* FreeBSD */ diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c index a0b6db742801..10d700678f8a 100644 --- a/sys/dev/twe/twe_freebsd.c +++ b/sys/dev/twe/twe_freebsd.c @@ -44,8 +44,6 @@ #include <dev/twe/twevar.h> #include <dev/twe/twe_tables.h> -#include <sys/devicestat.h> - static devclass_t twe_devclass; #ifdef TWE_DEBUG @@ -539,7 +537,6 @@ struct twed_softc struct twe_softc *twed_controller; /* parent device softc */ struct twe_drive *twed_drive; /* drive data in parent softc */ struct disk twed_disk; /* generic disk handle */ - struct devstat twed_stats; /* accounting */ }; /* @@ -705,11 +702,6 @@ twed_attach(device_t dev) sc->twed_drive->td_size / ((1024 * 1024) / TWE_BLOCK_SIZE), sc->twed_drive->td_size); - devstat_add_entry(&sc->twed_stats, "twed", device_get_unit(dev), TWE_BLOCK_SIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_ARRAY); - /* attach a generic disk device to ourselves */ sc->twed_disk.d_open = twed_open; @@ -746,7 +738,6 @@ twed_detach(device_t dev) if (sc->twed_disk.d_flags & DISKFLAG_OPEN) return(EBUSY); - devstat_remove_entry(&sc->twed_stats); #ifdef FREEBSD_4 if (--disks_registered == 0) cdevsw_remove(&tweddisk_cdevsw); diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index afadc8785936..38ec0933849d 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -118,7 +118,6 @@ #include <cam/scsi/scsi_all.h> #include <cam/scsi/scsi_da.h> -#include <sys/devicestat.h> #include <cam/cam_periph.h> #ifdef USB_DEBUG diff --git a/sys/dev/vinum/vinum.c b/sys/dev/vinum/vinum.c index 81d7a46de415..96065dc54768 100644 --- a/sys/dev/vinum/vinum.c +++ b/sys/dev/vinum/vinum.c @@ -43,7 +43,6 @@ #include <dev/vinum/vinumhdr.h> #include <sys/sysproto.h> /* for sync(2) */ -#include <sys/devicestat.h> #ifdef VINUMDEBUG #include <sys/reboot.h> int debug = 0; diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 3abc28f6225f..b97324615a39 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -66,7 +66,6 @@ #include <sys/stdint.h> #include <sys/sysctl.h> #include <sys/disk.h> -#include <sys/devicestat.h> #include <sys/fcntl.h> #include <sys/vnode.h> @@ -389,14 +388,6 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) ccg->ccg_nsectors = 1024 * 1024 / ccg->ccg_secsize; ccg->ccg_ncylinders = cs->sc_size / ccg->ccg_nsectors; - /* - * Add a devstat entry for this device. - */ - devstat_add_entry(&cs->device_stats, "ccd", cs->sc_unit, - ccg->ccg_secsize, DEVSTAT_ALL_SUPPORTED, - DEVSTAT_TYPE_STORARRAY |DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_ARRAY); - cs->sc_flags |= CCDF_INITED; cs->sc_cflags = cs->sc_flags; /* So we can find out later... */ return (0); @@ -574,10 +565,6 @@ ccdstart(struct ccd_s *cs, struct bio *bp) daddr_t bn; int err; - - /* Record the transaction start */ - devstat_start_transaction(&cs->device_stats); - /* * Translate the partition-relative block number to an absolute. */ @@ -909,7 +896,7 @@ ccdiodone(struct bio *ibp) if (bp->bio_resid == 0) { if (bp->bio_flags & BIO_ERROR) bp->bio_resid = bp->bio_bcount; - biofinish(bp, &cs->device_stats, 0); + biodone(bp); } } @@ -1180,9 +1167,6 @@ ccdioctltoo(int unit, u_long cmd, caddr_t data, int flag, struct thread *td) free(cs->sc_itable, M_CCD); free(cs->sc_vpp, M_CCD); - /* And remove the devstat entry. */ - devstat_remove_entry(&cs->device_stats); - /* This must be atomic. */ ccdunlock(cs); ccddestroy(cs); diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index dc04afbfa995..ae7a76205cea 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -48,6 +48,7 @@ #include <sys/malloc.h> #include <sys/sysctl.h> #include <sys/stdint.h> +#include <sys/devicestat.h> #include <machine/md_var.h> #include <sys/lock.h> @@ -161,12 +162,33 @@ g_disk_kerneldump(struct bio *bp, struct disk *dp) static void g_disk_done(struct bio *bp) { + struct bio *bp2; + struct disk *dp; + devstat_trans_flags flg; /* See "notes" for why we need a mutex here */ /* XXX: will witness accept a mix of Giant/unGiant drivers here ? */ mtx_lock(&g_disk_done_mtx); bp->bio_completed = bp->bio_length - bp->bio_resid; - g_std_done(bp); + + bp2 = bp->bio_parent; + dp = bp2->bio_to->geom->softc; + if (bp2->bio_error == 0) + bp2->bio_error = bp->bio_error; + bp2->bio_completed += bp->bio_completed; + g_destroy_bio(bp); + bp2->bio_inbed++; + if (bp2->bio_children == bp2->bio_inbed) { + if (bp2->bio_cmd == BIO_DELETE) + flg = DEVSTAT_FREE; + else if (bp2->bio_cmd == BIO_READ) + flg = DEVSTAT_READ; + else + flg = DEVSTAT_WRITE; + devstat_end_transaction(dp->d_devstat, bp2->bio_completed, + DEVSTAT_TAG_SIMPLE, flg); + g_io_deliver(bp2, bp2->bio_error); + } mtx_unlock(&g_disk_done_mtx); } @@ -197,6 +219,7 @@ g_disk_start(struct bio *bp) error = ENOMEM; break; } + devstat_start_transaction(dp->d_devstat); do { bp2->bio_offset += off; bp2->bio_length -= off; @@ -317,6 +340,10 @@ disk_create(int unit, struct disk *dp, int flags, void *unused __unused, void * KASSERT(dp->d_name != NULL, ("disk_create need d_name")); KASSERT(*dp->d_name != 0, ("disk_create need d_name")); KASSERT(strlen(dp->d_name) < SPECNAMELEN - 4, ("disk name too long")); + dp->d_devstat = g_malloc(sizeof *dp->d_devstat, M_WAITOK | M_ZERO); + devstat_add_entry(dp->d_devstat, dp->d_name, dp->d_unit, + dp->d_sectorsize, DEVSTAT_ALL_SUPPORTED, + DEVSTAT_TYPE_DIRECT, DEVSTAT_PRIORITY_MAX); g_call_me(g_disk_create, dp); } @@ -329,6 +356,7 @@ disk_destroy(struct disk *dp) gp->flags |= G_GEOM_WITHER; gp->softc = NULL; g_orphan_provider(LIST_FIRST(&gp->provider), ENXIO); + devstat_remove_entry(dp->d_devstat); } static void diff --git a/sys/ia64/ia64/autoconf.c b/sys/ia64/ia64/autoconf.c index 65da45116910..dcfd1b04dfde 100644 --- a/sys/ia64/ia64/autoconf.c +++ b/sys/ia64/ia64/autoconf.c @@ -39,7 +39,6 @@ #include <sys/mount.h> #include <sys/sysctl.h> #include <sys/bus.h> -#include <sys/devicestat.h> #include <sys/cons.h> #include <machine/md_var.h> diff --git a/sys/ia64/ia64/sscdisk.c b/sys/ia64/ia64/sscdisk.c index 3943cbd122db..8895ba47ebc6 100644 --- a/sys/ia64/ia64/sscdisk.c +++ b/sys/ia64/ia64/sscdisk.c @@ -17,7 +17,6 @@ #include <sys/systm.h> #include <sys/bio.h> #include <sys/conf.h> -#include <sys/devicestat.h> #include <sys/disk.h> #include <sys/kernel.h> #include <sys/linker.h> @@ -89,7 +88,6 @@ static LIST_HEAD(, ssc_s) ssc_softc_list = LIST_HEAD_INITIALIZER(&ssc_softc_list struct ssc_s { int unit; LIST_ENTRY(ssc_s) list; - struct devstat stats; struct bio_queue_head bio_queue; struct disk disk; dev_t dev; @@ -137,8 +135,6 @@ sscstrategy(struct bio *bp) if (!bp) break; - devstat_start_transaction(&sc->stats); - if (bp->bio_cmd == BIO_READ) { dop = DEVSTAT_READ; sscop = SSC_READ; @@ -169,7 +165,7 @@ sscstrategy(struct bio *bp) off += t; } bp->bio_resid = 0; - biofinish(bp, &sc->stats, 0); + biodone(bp); s = splbio(); } @@ -199,10 +195,6 @@ ssccreate(int unit) LIST_INSERT_HEAD(&ssc_softc_list, sc, list); sc->unit = unit; bioq_init(&sc->bio_queue); - devstat_add_entry(&sc->stats, "sscdisk", sc->unit, DEV_BSIZE, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_OTHER, - DEVSTAT_PRIORITY_OTHER); sc->disk.d_strategy = sscstrategy; sc->disk.d_name = "sscdisk"; diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index 939f829be35c..ff4e7f7f42f2 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -68,7 +68,6 @@ #include <sys/disk.h> #include <sys/disklabel.h> #include <sys/bio.h> -#include <sys/devicestat.h> #include <sys/malloc.h> #include <machine/bootinfo.h> #include <sys/cons.h> @@ -185,9 +184,6 @@ struct softc { struct diskgeom dk_dd; /* device configuration data */ struct diskslices *dk_slices; /* virtual drives */ void *dk_dmacookie; /* handle for DMA services */ - - struct devstat dk_stats; /* devstat entry */ - struct disk disk; }; @@ -564,16 +560,6 @@ wdattach(struct isa_device *dvp) wdtimeout(du); /* - * Export the drive to the devstat interface. - */ - devstat_add_entry(&du->dk_stats, "wd", - lunit, du->dk_dd.d_secsize, - DEVSTAT_NO_ORDERED_TAGS, - DEVSTAT_TYPE_DIRECT | - DEVSTAT_TYPE_IF_IDE, - DEVSTAT_PRIORITY_DISK); - - /* * Register this media as a disk */ du->disk.d_open = wdopen; @@ -662,9 +648,6 @@ wdstrategy(struct bio *bp) if (wdtab[du->dk_ctrlr_cmd640].b_active == 0) wdstart(du->dk_ctrlr); /* start controller */ - /* Tell devstat that we have started a transaction on this drive */ - devstat_start_transaction(&du->dk_stats); - splx(s); return; @@ -1193,7 +1176,7 @@ done: ; bp->bio_resid = bp->bio_bcount - du->dk_skip * DEV_BSIZE; wdutab[du->dk_lunit].b_active = 0; du->dk_skip = 0; - biofinish(bp, &du->dk_stats, 0); + biodone(bp); } /* controller idle */ diff --git a/sys/sys/ccdvar.h b/sys/sys/ccdvar.h index 1ceb32659ce0..d44f0dc5b6db 100644 --- a/sys/sys/ccdvar.h +++ b/sys/sys/ccdvar.h @@ -168,7 +168,6 @@ struct ccd_s { #define CCD_MAXNDISKS 65536 struct ccdcinfo *sc_cinfo; /* component info */ struct ccdiinfo *sc_itable; /* interleave table */ - struct devstat device_stats; /* device statistics */ struct ccdgeom sc_geom; /* pseudo geometry info */ int sc_pick; /* side of mirror picked */ daddr_t sc_blk[2]; /* mirror localization */ diff --git a/sys/sys/disk.h b/sys/sys/disk.h index 7031e1528535..063100cded79 100644 --- a/sys/sys/disk.h +++ b/sys/sys/disk.h @@ -31,10 +31,12 @@ typedef int disk_ioctl_t(struct disk *, u_long cmd, void *data, /* NB: disk_ioctl_t SHALL be cast'able to d_ioctl_t */ struct g_geom; +struct devstat; struct disk { /* Fields which are private to geom_disk */ struct g_geom *d_geom; + struct devstat *d_devstat; /* Shared fields */ u_int d_flags; |
