On Mon, Sep 02, 2024 at 10:56:10PM +0200, Luca Stefani wrote: > It can be used to calculate the sector size limit of each > discard call allowing filesystem to implement their own > chunked discard logic with customized behavior, for example > cancellation due to signals. Maybe to add context for block layer people why we want to export this: The fs trim loops over ranges and sends discard requests, some ranges can be large so it's all transparently handled by blkdev_issue_discard() and processed in smaller chunks. We need to insert checks for cancellation (or suspend) requests into the the loop. Rather than setting an arbitrary chunk length on the filesystem level I've suggested to use bio_discard_limit() assuming it will do optimal number of IO requests. Then we don't have to guess whether 1G or 10G is the right value, unnecessarily increasing the number of requests when the device could handle larger ranges.