Allow the file system to keep state for all iterations. For now only wire it up for direct I/O as there is an immediate need for it. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- fs/iomap/direct-io.c | 3 +++ include/linux/iomap.h | 1 + 2 files changed, 4 insertions(+) diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index a434b1829545d..63ee37b40fd8f 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -477,6 +477,7 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, .pos = iocb->ki_pos, .len = iov_iter_count(iter), .flags = IOMAP_DIRECT, + .private = iocb->private, }; loff_t end = iomi.pos + iomi.len - 1, ret = 0; bool wait_for_completion = @@ -504,6 +505,8 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter, dio->submit.waiter = current; dio->submit.poll_bio = NULL; + WRITE_ONCE(iocb->private, NULL); + if (iov_iter_rw(iter) == READ) { if (iomi.pos >= dio->i_size) goto out_free_dio; diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 97a3a2edb5850..3cc5ee01066d0 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -188,6 +188,7 @@ struct iomap_iter { unsigned flags; struct iomap iomap; struct iomap srcmap; + void *private; }; int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops); -- 2.30.2