For the dynamic I/O scheduler, make the TRIM stuff also count against

read bias so we do reads in preference to TRIMs. This helps a lot when
many trims are delivered at once from the upper layers as they tend to
delay READs due to priority inversion in the code today.

The non iosched case will be fixed when the trim comibing changes
needed for nvme come in later this year.

Sponsored by: Netflix
This commit is contained in:
imp 2018-07-26 22:55:51 +00:00
parent 9078928a8c
commit 61ca973984

View File

@ -1307,7 +1307,23 @@ cam_iosched_get_trim(struct cam_iosched_softc *isc)
if (!cam_iosched_has_more_trim(isc))
return NULL;
#ifdef CAM_IOSCHED_DYNAMIC
if (do_dynamic_iosched) {
/*
* If pending read, prefer that based on current read bias
* setting.
*/
if (bioq_first(&isc->bio_queue) && isc->current_read_bias) {
isc->current_read_bias--;
/* We're not limiting TRIMS, per se, just doing reads first */
return NULL;
}
/*
* We're going to do a trim, so reset the bias.
*/
isc->current_read_bias = isc->read_bias;
}
#endif
return cam_iosched_next_trim(isc);
}