On Fri, Mar 17, 2023 at 12:59:37PM -0700, Bart Van Assche wrote: > +unsigned int bio_nr_segments(const struct queue_limits *lim, struct bio *bio) The name is wrong, as it operates not on a single bio, but rather on a chain of bios. That being said it seems like your caller in the next patch only cares about the regulad read/write bio case, which is kust this: > + for_each_bio(bio) > + bio_for_each_bvec(bv, bio, iter) > + bvec_split_segs(lim, &bv, &nr_phys_segs, &bytes, > + UINT_MAX, UINT_MAX); So maybe split that into a separat patch. Also please pass the queue_limit after the bio like the other functions in this file.