Created attachment 185944 [details]
cam iosched: Fix trim statistics
The attached patch fixes the cam iosched trim statistics.
When cam_iosched_bio_complete() gets called, all pending
BIO_DELETEs are done.
Previously only one of them was accounted for, as a result
the "pending" counter got higher and higher and the "out"
count was off as well. An ElectroBSD release build in a vm
resulted in ~60k "leaked" pending trims.
cam_iosched_ticker() has a note that seems to refer to this
bug but I didn't adjust it.
Obtained from: ElectroBSD
This isn't true for nvme drives.
We should decrease the numbers by the number of bios completed.
Do you mean that the trim statistics currently work for nvme drives and
the patch would break them, or that they are broken as well but the patch
wouldn't fix them?
I don't have access to nvme drives and only tested the patch with ada drives.
While I also use iosched with da drives, they don't have trim support.
Setting the pending counter to zero is not valid because there could be more than one trim active.