On Wed, Jan 05, 2022 at 08:16:05AM +1100, Dave Chinner wrote: > > > + if (ioend->io_inline_bio.bi_iter.bi_sector + (ioend->io_size >> 9) != > > > > This open codes bio_end_sector() > > No, it doesn't. The ioend can have chained bios or have others merged > and concatenated to the ioend->io_list, so ioend->io_size != length > of the first bio in the chain.... > > > > + next->io_inline_bio.bi_iter.bi_sector) > > > > But more importantly I don't think just using the inline_bio makes sense > > here as the ioend can have multiple bios. Fortunately we should always > > have the last built bio available in ->io_bio. > > Except merging chains ioends and modifies the head io_size to > account for the chained ioends we add to ioend->io_list. Hence > ioend->io_bio is not the last bio in a contiguous ioend chain. Indeed. We could use bio_end_sector on io_bio or this.