aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Grooms <mgrooms@shrew.net>2024-05-03 14:41:05 +0000
committerWarner Losh <imp@FreeBSD.org>2024-05-20 19:23:40 +0000
commit4c2ea6e26d210d07d29c845addeb0c2a103f5904 (patch)
tree54c3f649a4e5e784b3790dbad9022bc7bff4fb24
parent5dd6fb108dd9f5abbacbdc73197ef8468b93b958 (diff)
downloadsrc-4c2ea6e26d210d07d29c845addeb0c2a103f5904.tar.gz
src-4c2ea6e26d210d07d29c845addeb0c2a103f5904.zip
da: Update trim stats for WRITE SAME and ATA TRIM
The scsi UNMAP path updated trim stats in the da sysctl, but the ATA TRIM passthru and WRITE SAME paths did not. Add code so they do. PR: 277637 Reviewed by: imp (tweaked WS path to update ranges) (cherry picked from commit 12117d0e9314d1706508386c1c49ace2de578b31)
-rw-r--r--sys/cam/scsi/scsi_da.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index ae691520e157..5b1cc7314984 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -4209,6 +4209,9 @@ da_delete_trim(struct cam_periph *periph, union ccb *ccb, struct bio *bp)
da_default_timeout * 1000);
ccb->ccb_h.ccb_state = DA_CCB_DELETE;
ccb->ccb_h.flags |= CAM_UNLOCKED;
+ softc->trim_count++;
+ softc->trim_ranges += ranges;
+ softc->trim_lbas += block_count;
cam_iosched_submit_trim(softc->cam_iosched);
}
@@ -4269,6 +4272,9 @@ da_delete_ws(struct cam_periph *periph, union ccb *ccb, struct bio *bp)
da_default_timeout * 1000);
ccb->ccb_h.ccb_state = DA_CCB_DELETE;
ccb->ccb_h.flags |= CAM_UNLOCKED;
+ softc->trim_count++;
+ softc->trim_ranges++;
+ softc->trim_lbas += count;
cam_iosched_submit_trim(softc->cam_iosched);
}