On Fri, 22 Jan 2021 19:38:24 +0000 Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > > + bio_for_each_segment(bvec, bio, iter) { > > + unsigned int len = bvec.bv_len; > > + int err; > > + > > + /* Alignment check */ > > + WARN_ON_ONCE((bvec.bv_offset & (MIN_ALIGNMENT - 1)) || > > + (len & (MIN_ALIGNMENT - 1))); > > + > > + err = n64cart_do_bvec(dev, &bvec, len, > > + bvec.bv_offset, pos); > > + if (err) > > + goto io_error; > > + pos += len; > > Nit: I'd just pass the bvec to n64cart_do_bvec, calculate pos there > locally each time, and also move the WARN_ON_ONCE into the helper. I don't think calculating pos there would work? It doesn't know how many bio segments were processed and what lengths they were. - Lauri