Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c. As a side effect this makes a lot of #include <sys/devicestat.h> lines not needed and some biofinish() calls can be reduced to biodone() again.
This commit is contained in:
parent
74c69254e6
commit
60794e0478
@ -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>
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
struct devstat;
|
||||
|
||||
extern struct cam_periph *xpt_periph;
|
||||
|
||||
extern struct periph_driver **periph_drivers;
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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);
|
||||
@ -1186,20 +1176,6 @@ daregister(struct cam_periph *periph, void *arg)
|
||||
SLIST_INSERT_HEAD(&softc_list, softc, links);
|
||||
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;
|
||||
|
@ -75,7 +75,6 @@
|
||||
#else
|
||||
#include <machine/clock.h>
|
||||
#endif
|
||||
#include <sys/devicestat.h>
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
#include <sys/buf.h>
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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
|
||||
|
||||
/************************************************************************
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
};
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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>
|
||||
|
@ -46,7 +46,6 @@
|
||||
|
||||
#include <sys/bio.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/devicestat.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/disk.h>
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <sys/bio.h>
|
||||
#include <sys/devicestat.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/disk.h>
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include <sys/bio.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/devicestat.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/disk.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;
|
||||
|
@ -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)
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/devicestat.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/stat.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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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>
|
||||
|
@ -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) */
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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";
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
@ -563,16 +559,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
|
||||
*/
|
||||
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user