This wrapper around copy_page_to_iter() works because copy_page_to_iter() handles compound pages correctly.
Showing the changes to include (1 of 1 file). Show all
Unified · Split
| @@ -7,6 +7,7 @@ · 6 unmodified lines | ||
| 7 | 7 | |
| 8 | 8 | #include <linux/kernel.h> |
| 9 | 9 | #include <linux/thread_info.h> |
| 10 | +#include <linux/mm_types.h> | |
| 10 | 11 | #include <uapi/linux/uio.h> |
| 11 | 12 | |
| 12 | 13 | struct page; |
| @@ -146,6 +147,12 @@ size_t _copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i); · 133 unmodified lines | ||
| 146 | 147 | size_t _copy_from_iter(void *addr, size_t bytes, struct iov_iter *i); |
| 147 | 148 | size_t _copy_from_iter_nocache(void *addr, size_t bytes, struct iov_iter *i); |
| 148 | 149 | |
| 150 | +static inline size_t copy_folio_to_iter(struct folio *folio, size_t offset, | |
| 151 | + size_t bytes, struct iov_iter *i) | |
| 152 | +{ | |
| 153 | + return copy_page_to_iter(&folio->page, offset, bytes, i); | |
| 154 | +} | |
| 155 | + | |
| 149 | 156 | static __always_inline __must_check |
| 150 | 157 | size_t copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) |
| 151 | 158 | { |