Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109799528
D46035.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D46035.diff
View Options
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
@@ -1834,13 +1834,6 @@
announce_buf = softc->announce_temp;
bzero(announce_buf, ADA_ANNOUNCETMP_SZ);
- if (cam_iosched_init(&softc->cam_iosched, periph) != 0) {
- printf("adaregister: Unable to probe new device. "
- "Unable to allocate iosched memory\n");
- free(softc, M_DEVBUF);
- return(CAM_REQ_CMP_ERR);
- }
-
periph->softc = softc;
xpt_path_inq(&softc->cpi, periph->path);
@@ -1901,8 +1894,6 @@
} else {
softc->flags |= ADA_FLAG_ROTATING;
}
- cam_iosched_set_sort_queue(softc->cam_iosched,
- (softc->flags & ADA_FLAG_ROTATING) ? -1 : 0);
softc->disk = disk_alloc();
adasetgeom(softc, cgd);
softc->disk->d_devstat = devstat_new_entry(periph->periph_name,
@@ -1921,6 +1912,16 @@
softc->disk->d_name = "ada";
softc->disk->d_drv1 = periph;
softc->disk->d_unit = periph->unit_number;
+
+ if (cam_iosched_init(&softc->cam_iosched, periph, softc->disk) != 0) {
+ printf("adaregister: Unable to probe new device. "
+ "Unable to allocate iosched memory\n");
+ free(softc, M_DEVBUF);
+ return(CAM_REQ_CMP_ERR);
+ }
+ cam_iosched_set_sort_queue(softc->cam_iosched,
+ (softc->flags & ADA_FLAG_ROTATING) ? -1 : 0);
+
cam_periph_lock(periph);
dp = &softc->params;
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
@@ -80,7 +80,8 @@
typedef void (*cam_iosched_latfcn_t)(void *, sbintime_t, struct bio *);
-int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph);
+int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph,
+ const struct disk *dp);
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
@@ -314,6 +314,7 @@
struct cam_iosched_softc {
struct bio_queue_head bio_queue;
struct bio_queue_head trim_queue;
+ const struct disk *disk;
/* scheduler flags < 16, user flags >= 16 */
uint32_t flags;
int sort_io_queue;
@@ -1153,12 +1154,14 @@
* sizeof struct cam_iosched_softc.
*/
int
-cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph)
+cam_iosched_init(struct cam_iosched_softc **iscp, struct cam_periph *periph,
+ const struct disk *dp)
{
*iscp = malloc(sizeof(**iscp), M_CAMSCHED, M_NOWAIT | M_ZERO);
if (*iscp == NULL)
return ENOMEM;
+ (*iscp)->disk = dp;
#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
@@ -862,13 +862,6 @@
return(CAM_REQ_CMP_ERR);
}
- if (cam_iosched_init(&softc->cam_iosched, periph) != 0) {
- printf("ndaregister: Unable to probe new device. "
- "Unable to allocate iosched memory\n");
- free(softc, M_DEVBUF);
- return(CAM_REQ_CMP_ERR);
- }
-
/* ident_data parsing */
periph->softc = softc;
@@ -891,7 +884,6 @@
quirks = softc->quirks;
TUNABLE_INT_FETCH(announce_buf, &quirks);
softc->quirks = quirks;
- cam_iosched_set_sort_queue(softc->cam_iosched, 0);
softc->disk = disk = disk_alloc();
disk->d_rotation_rate = DISK_RR_NON_ROTATING;
disk->d_open = ndaopen;
@@ -953,6 +945,15 @@
DEVSTAT_ALL_SUPPORTED,
DEVSTAT_TYPE_DIRECT | XPORT_DEVSTAT_TYPE(cpi.transport),
DEVSTAT_PRIORITY_DISK);
+
+ if (cam_iosched_init(&softc->cam_iosched, periph, disk) != 0) {
+ printf("ndaregister: Unable to probe new device. "
+ "Unable to allocate iosched memory\n");
+ free(softc, M_DEVBUF);
+ return(CAM_REQ_CMP_ERR);
+ }
+ cam_iosched_set_sort_queue(softc->cam_iosched, 0);
+
/*
* Add alias for older nvd drives to ease transition.
*/
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
@@ -2804,13 +2804,6 @@
return(CAM_REQ_CMP_ERR);
}
- if (cam_iosched_init(&softc->cam_iosched, periph) != 0) {
- printf("daregister: Unable to probe new device. "
- "Unable to allocate iosched memory\n");
- free(softc, M_DEVBUF);
- return(CAM_REQ_CMP_ERR);
- }
-
LIST_INIT(&softc->pending_ccbs);
softc->state = DA_STATE_PROBE_WP;
bioq_init(&softc->delete_run_queue);
@@ -2979,7 +2972,13 @@
softc->disk->d_hba_subdevice = cpi.hba_subdevice;
snprintf(softc->disk->d_attachment, sizeof(softc->disk->d_attachment),
"%s%d", cpi.dev_name, cpi.unit_number);
- cam_periph_lock(periph);
+
+ if (cam_iosched_init(&softc->cam_iosched, periph, softc->disk) != 0) {
+ printf("daregister: Unable to probe new device. "
+ "Unable to allocate iosched memory\n");
+ free(softc, M_DEVBUF);
+ return(CAM_REQ_CMP_ERR);
+ }
/*
* Add async callbacks for events of interest.
@@ -2988,6 +2987,7 @@
* fine without them and the only alternative
* would be to not attach the device on failure.
*/
+ cam_periph_lock(periph);
xpt_register_async(AC_SENT_BDR | AC_BUS_RESET | AC_LOST_DEVICE |
AC_ADVINFO_CHANGED | AC_SCSI_AEN | AC_UNIT_ATTENTION |
AC_INQ_CHANGED, daasync, periph, periph->path);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 10, 4:54 PM (1 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16580488
Default Alt Text
D46035.diff (5 KB)
Attached To
Mode
D46035: cam/iosched: Pass in the disk when initializing
Attached
Detach File
Event Timeline
Log In to Comment