The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4afa62be71674b76c31ea513d6c470089a6c1848

commit 4afa62be71674b76c31ea513d6c470089a6c1848
Author:     Warner Losh <i...@freebsd.org>
AuthorDate: 2021-06-18 17:57:57 +0000
Commit:     Warner Losh <i...@freebsd.org>
CommitDate: 2021-06-21 01:14:13 +0000

    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
---
 sys/cam/cam_iosched.c | 3 ++-
 sys/cam/cam_xpt.c     | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

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];
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to