diff options
| author | Christian Brauner <brauner@kernel.org> | 2024-04-11 10:06:08 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2024-04-11 10:06:08 +0200 |
| commit | 3a93daea2fb27fcefa85662654ba583a5d0c7231 (patch) | |
| tree | 4af6446af26ebfe51fe2da7cc22a7fc36fafcc1f /include/linux | |
| parent | fec50db7033ea478773b159e0e2efb135270e3b7 (diff) | |
| parent | fbe38120eb1dec94280d0381ce4aea52c44367b1 (diff) | |
Merge branch 'read_iter' of git://git.kernel.dk/linux
Pull read_iter updates from Jens Axboe:
There are still a few users of fops->read() in the core parts of the
fs stack. Which is a shame, since it'd be nice to get rid of the
non-iterator parts of down the line, and reclaim that part of the
file_operations struct.
Outside of moving in that direction as a cleanup, using ->read_iter()
enables us to mark them with FMODE_NOWAIT. This is important for users
like io_uring, where per-IO nonblocking hints make a difference in how
efficiently IO can be done.
Those two things are my main motivation for starting this work, with
hopefully more to come down the line.
All patches have been booted and tested, and the corresponding test
cases from ltp have been run.
* 'read_iter' of git://git.kernel.dk/linux: (4 commits)
signalfd: convert to ->read_iter()
userfaultfd: convert to ->read_iter()
timerfd: convert to ->read_iter()
new helper: copy_to_iter_full()
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/uio.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h index 00cebe2b70de..7020adedfa08 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -206,6 +206,16 @@ size_t copy_from_iter(void *addr, size_t bytes, struct iov_iter *i) } static __always_inline __must_check +bool copy_to_iter_full(const void *addr, size_t bytes, struct iov_iter *i) +{ + size_t copied = copy_to_iter(addr, bytes, i); + if (likely(copied == bytes)) + return true; + iov_iter_revert(i, copied); + return false; +} + +static __always_inline __must_check bool copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i) { size_t copied = copy_from_iter(addr, bytes, i); |
