On Sat, Sep 10, 2022 at 12:18:10AM +0100, David Howells wrote: > Hi Al, Jeff, > > Here's a replacement for the extract_iter_to_iter() patch I had previously. > It's a WIP, some bits aren't fully implemented, though some bits I have tested > and got to work, but if you could take a look and see if you're okay with the > interface. > > I think I've addressed most of Al's comments. The page-pinning is conditional > on certain types of iterator, and a number of the iterator types just extract > to the same thing. It should now handle kvec-class iterators that refer to > vmalloc'd data. > > I've also added extraction to scatterlist (which I'll need for doing various > crypto things) and extraction to ib_sge which could be used in cifs/smb RDMA, > bypassing the conversion-to-scatterlist step. > > As mentioned, there are bits that aren't fully implemented, let alone tested. IDGI. Essentially, you are passing a callback disguised as enum, only to lose any type safety. How is it better than "iov_iter_get_pages2() into a fixed-sized array and handle the result" done in a loop? No need to advance it (iov_iter_get_page2() auto-advances), *way* fewer conditional branches and no need to share anything between the 3 functions you are after... > +ssize_t extract_iter_to_sg(struct iov_iter *iter, size_t len, > + struct sg_table *sgtable, bool *pages_pinned) Your *pages_pinned is user_backed_iter(iter), isn't it?