> +#ifdef CONFIG_DEBUG_KERNEL
That's a pretty broad option. Not that I have any better idea off the
bat.
> +static inline bool bio_iov_bvec_aligned(const struct bio *bio,
> + unsigned mem_align_mask)
> +{
> + /*
> + * The vectors are owned and laid out by the caller; we only forward
> + * them. Most callers are already aligned, but io_uring can place a
> + * user chosen offset through a registered buffer, where only the first
> + * vector may be unaligned.
> + */
> + return !(mp_bvec_iter_offset(bio->bi_io_vec, bio->bi_iter) &
> + mem_align_mask);
I don't fully understand the comment. I guess this is to say ITER_BVEC
users better don't create any alignment gaps? Maybe we should also
clearly document that in uio.h?
> return bio_iov_iter_get_pages(bio, iter,
> + bdev_dma_alignment(bdev),
Nit: this easily fits onto the previous line.
Otherwise this looks good.