iomap: Do not create fake iter in iomap_dio_bio_actor()
authorJan Kara <jack@suse.cz>
Tue, 26 Nov 2019 17:28:47 +0000 (09:28 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 26 Nov 2019 17:28:47 +0000 (09:28 -0800)
commitf550ee9b85fd47f85e31965b908a7c1044c531aa
treeaf48433f8175cc792120556efe930cf291d99a49
parent419e9c38aa075ed0cd3c13d47e15954b686bcdb6
iomap: Do not create fake iter in iomap_dio_bio_actor()

iomap_dio_bio_actor() copies iter to a local variable and then limits it
to a file extent we have mapped. When IO is submitted,
iomap_dio_bio_actor() advances the original iter while the copied iter
is advanced inside bio_iov_iter_get_pages(). This logic is non-obvious
especially because both iters still point to same shared structures
(such as pipe info) so if iov_iter_advance() changes anything in the
shared structure, this scheme breaks. Let's just truncate and reexpand
the original iter as needed instead of playing games with copying iters
and keeping them in sync.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/iomap/direct-io.c