git: 7845cf8de8db - main - ada: Update trim stats for every bio
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 06 Oct 2026 22:58:52 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=7845cf8de8db3f6dd60a69379907b51b80123eae
commit 7845cf8de8db3f6dd60a69379907b51b80123eae
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-10-06 22:45:55 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-10-06 22:46:23 +0000
ada: Update trim stats for every bio
Separate the updating the stats for the completion from the biodone for
each one.
Sponsored by: Netflix
Reviewed by: ali_mashtizadeh.com
Differential Revision: https://reviews.freebsd.org/D60157
---
sys/cam/ata/ata_da.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index 9a088cc74337..9c6a5ba2f51d 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -2941,7 +2941,8 @@ adadone(struct cam_periph *periph, union ccb *done_ccb)
case ADA_CCB_BUFFER_IO:
case ADA_CCB_TRIM:
{
- struct bio *bp;
+ struct bio *bp, *bp1;
+ struct bio_queue queue;
int error;
KASSERT(priority == CAM_PRIORITY_NORMAL,
@@ -3010,16 +3011,18 @@ adadone(struct cam_periph *periph, union ccb *done_ccb)
* extensive. Release the periph refcount taken in adastart()
* for each CCB.
*/
- cam_iosched_bio_update_stats(softc->cam_iosched, bp, done_ccb);
+ if (state == ADA_CCB_TRIM) {
+ TAILQ_INIT(&queue);
+ TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue);
+ cam_iosched_bio_queue_update_stats(softc->cam_iosched,
+ &queue, done_ccb, error);
+ } else
+ cam_iosched_bio_update_stats(softc->cam_iosched, bp,
+ done_ccb);
xpt_release_ccb(done_ccb);
KASSERT(softc->refcount >= 1, ("adadone softc %p refcount %d", softc, softc->refcount));
softc->refcount--;
if (state == ADA_CCB_TRIM) {
- TAILQ_HEAD(, bio) queue;
- struct bio *bp1;
-
- TAILQ_INIT(&queue);
- TAILQ_CONCAT(&queue, &softc->trim_req.bps, bio_queue);
/*
* Normally, the xpt_release_ccb() above would make sure
* that when we have more work to do, that work would
@@ -3035,12 +3038,6 @@ adadone(struct cam_periph *periph, union ccb *done_ccb)
cam_periph_unlock(periph);
while ((bp1 = TAILQ_FIRST(&queue)) != NULL) {
TAILQ_REMOVE(&queue, bp1, bio_queue);
- bp1->bio_error = error;
- if (error != 0) {
- bp1->bio_flags |= BIO_ERROR;
- bp1->bio_resid = bp1->bio_bcount;
- } else
- bp1->bio_resid = 0;
biodone(bp1);
}
} else {