Subject nitpick: this does not ouch iomap at all.
Fix this by replacing the use of an ITER_PIPE iterator with an ITER_BVEC
iterator for which reversion won't free the buffers. Bulk allocate all the
buffers we think we're going to use in advance, do the read synchronously
and only then trim the buffer down. The pages we did use get pushed into
the pipe.
This is more efficient by virtue of doing a bulk page allocation, but
slightly less efficient by ignoring any partial page in the pipe.
For the usual case of a buffered read into the iter, this completely
changes the semantics:
- before the pagecache pages just grew a new reference and were
added to the pipe buffer, and I/O was done without an extra
copy
- with this patch you always allocate an extra set of pages for
the pipe and copy to it
So I very much doubt this makes anything more efficient, and I don't
think we can just do it.
We'll have to fix reverting of pipe buffers, just as I already pointed
out in your cifs series that tries to play the same game.