diff options
author | Warner Losh <imp@FreeBSD.org> | 2021-06-18 17:57:57 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2021-06-21 01:14:13 +0000 |
commit | 4afa62be71674b76c31ea513d6c470089a6c1848 (patch) | |
tree | 72f1d3dedecc8601527a1c4f23f8340cd9c8e8eb | |
parent | 13604fb0fd43c85e6bb3a0ad6400a684f150bdea (diff) | |
download | src-4afa62be71674b76c31ea513d6c470089a6c1848.tar.gz src-4afa62be71674b76c31ea513d6c470089a6c1848.zip |
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
-rw-r--r-- | sys/cam/cam_iosched.c | 3 | ||||
-rw-r--r-- | sys/cam/cam_xpt.c | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/sys/cam/cam_iosched.c b/sys/cam/cam_iosched.c index ba1bc4843163..d30eb34747e1 100644 --- a/sys/cam/cam_iosched.c +++ b/sys/cam/cam_iosched.c @@ -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); diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 762feaf5dd49..b0e112868383 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -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]; |