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
This commit is contained in:
Warner Losh committed 2026-10-06 16:46:23 -06:00
1 parent bd86f0508e
commit 7845cf8de8
1 file changed
+10 -13
+10 -13
View File
@@ -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 {