diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -1913,7 +1913,8 @@ softc->disk->d_drv1 = periph; softc->disk->d_unit = periph->unit_number; - if (cam_iosched_init(&softc->cam_iosched, periph, softc->disk) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph, softc->disk, + adaschedule) != 0) { printf("adaregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); free(softc, M_DEVBUF); diff --git a/sys/cam/cam_iosched.h b/sys/cam/cam_iosched.h --- a/sys/cam/cam_iosched.h +++ b/sys/cam/cam_iosched.h @@ -79,9 +79,10 @@ } typedef void (*cam_iosched_latfcn_t)(void *, sbintime_t, struct bio *); +typedef void (*cam_iosched_schedule_t)(struct cam_periph *periph); int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph, - const struct disk *dp); + const struct disk *dp, cam_iosched_schedule_t schedfnp); void cam_iosched_fini(struct cam_iosched_softc *); void cam_iosched_sysctl_init(struct cam_iosched_softc *, struct sysctl_ctx_list *, struct sysctl_oid *); struct bio *cam_iosched_next_trim(struct cam_iosched_softc *isc); diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -315,6 +315,7 @@ struct bio_queue_head bio_queue; struct bio_queue_head trim_queue; const struct disk *disk; + cam_iosched_schedule_t schedfnc; /* scheduler flags < 16, user flags >= 16 */ uint32_t flags; int sort_io_queue; @@ -619,7 +620,7 @@ cam_iosched_limiter_tick(&isc->write_stats); cam_iosched_limiter_tick(&isc->trim_stats); - cam_iosched_schedule(isc, isc->periph); + isc->schedfnc(isc->periph); /* * isc->load is an EMA of the pending I/Os at each tick. The number of @@ -1155,13 +1156,14 @@ */ int cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph, - const struct disk *dp) + const struct disk *dp, cam_iosched_schedule_t schedfnc) { *iscp = malloc(sizeof(**iscp), M_CAMSCHED, M_NOWAIT | M_ZERO); if (*iscp == NULL) return ENOMEM; (*iscp)->disk = dp; + (*iscp)->schedfnc = schedfnc; #ifdef CAM_IOSCHED_DYNAMIC if (iosched_debug) printf("CAM IOSCHEDULER Allocating entry at %p\n", *iscp); diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -946,7 +946,8 @@ DEVSTAT_TYPE_DIRECT | XPORT_DEVSTAT_TYPE(cpi.transport), DEVSTAT_PRIORITY_DISK); - if (cam_iosched_init(&softc->cam_iosched, periph, disk) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph, disk, + ndaschedule) != 0) { printf("ndaregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); free(softc, M_DEVBUF); diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -2973,7 +2973,8 @@ snprintf(softc->disk->d_attachment, sizeof(softc->disk->d_attachment), "%s%d", cpi.dev_name, cpi.unit_number); - if (cam_iosched_init(&softc->cam_iosched, periph, softc->disk) != 0) { + if (cam_iosched_init(&softc->cam_iosched, periph, softc->disk, + daschedule) != 0) { printf("daregister: Unable to probe new device. " "Unable to allocate iosched memory\n"); free(softc, M_DEVBUF);