On Wed, Jun 09, 2021 at 08:45:56AM +0800, Ming Lei wrote: > diff --git a/block/blk-merge.c b/block/blk-merge.c > index bcdff1879c34..65210e9a8efa 100644 > --- a/block/blk-merge.c > +++ b/block/blk-merge.c > @@ -724,10 +724,10 @@ static inline bool blk_discard_mergable(struct request *req) > static enum elv_merge blk_try_req_merge(struct request *req, > struct request *next) > { > - if (blk_discard_mergable(req)) > - return ELEVATOR_DISCARD_MERGE; > - else if (blk_rq_pos(req) + blk_rq_sectors(req) == blk_rq_pos(next)) > + if (blk_rq_pos(req) + blk_rq_sectors(req) == blk_rq_pos(next)) > return ELEVATOR_BACK_MERGE; Oh well, this breaks my previous suggestions. > + struct req_discard_range r; > + > + rq_for_each_discard_range(r, req) { ... and I can't say I like this rather complex iterator. What is the problem of just fixing the raid code to not submit stupidly small discard requests instead?