cam: Set the CAM_QOS_VALID when valid

When the elapsed time of the operation is complete and stored in the QOS
field, set the CAM_QOS_VALID bit.  In iosched, test to make sure it's
set before using it.

Sponsored by:		Netflix
This commit is contained in:
Warner Losh 2021-06-18 11:57:57 -06:00
parent 13604fb0fd
commit 4afa62be71
2 changed files with 3 additions and 1 deletions

View File

@ -1685,7 +1685,8 @@ cam_iosched_bio_complete(struct cam_iosched_softc *isc, struct bio *bp,
printf("Completing command with bio_cmd == %#x\n", bp->bio_cmd);
}
if (!(bp->bio_flags & BIO_ERROR) && done_ccb != NULL) {
if ((bp->bio_flags & BIO_ERROR) == 0 && done_ccb != NULL &&
(done_ccb->ccb_h.status & CAM_QOS_VALID) != 0) {
sbintime_t sim_latency;
sim_latency = cam_iosched_sbintime_t(done_ccb->ccb_h.qos.periph_data);

View File

@ -4617,6 +4617,7 @@ xpt_done(union ccb *done_ccb)
/* Store the time the ccb was in the sim */
done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data);
done_ccb->ccb_h.status |= CAM_QOS_VALID;
hash = (u_int)(done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id +
done_ccb->ccb_h.target_lun) % cam_num_doneqs;
queue = &cam_doneqs[hash];