On Fri, Mar 17, 2023 at 12:59:38PM -0700, Bart Van Assche wrote: > @@ -380,8 +380,9 @@ struct bio *__bio_split_to_limits(struct bio *bio, > blkcg_bio_issue_init(split); > bio_chain(split, bio); > trace_block_split(split, bio->bi_iter.bi_sector); > - submit_bio_noacct(bio); > - return split; > + submit_bio_noacct(split); > + *nr_segs = bio_nr_segments(lim, bio); Please add this recalculation into the individual bio_split_* functions, as the recalculation is only needed for regular read/write bios. It might also be slightly cheaper to just continue the segment calculation there in the existing loop instead of starting a new one after the split.