[Devel] [PATCH rh7 v2 4/4] fs/iov_iter: Drop ITER_PAGE iov_iter primitive - no users
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Dec 25 19:15:08 MSK 2020
And no such iterator in mainstream kernel as well =>
good reason to drop it.
To_merge: 3f4f3e9c9d8e ("mm: extend generic iov iterator API")
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
include/linux/fs.h | 26 ---------
mm/iov-iter.c | 141 ---------------------------------------------
2 files changed, 167 deletions(-)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d4c143fa7212..f30f19fa0b33 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -337,7 +337,6 @@ enum iter_type {
ITER_BVEC = 16, /* ii_bvec_ops */
ITER_PIPE = 32, /* ms type, not used in vzkernel */
ITER_DISCARD = 64, /* ms type, not used in vzkernel */
- ITER_PAGE = 128, /* ii_page_ops, currently not used */
ITER_PLAIN = 256, /* ii_plain_ops */
ITER_BAD = 512, /* ii_bad_ops */
};
@@ -361,7 +360,6 @@ struct iov_iter {
};
extern struct iov_iter_ops ii_bvec_ops;
-extern struct iov_iter_ops ii_page_ops;
extern struct iov_iter_ops ii_iovec_ops;
extern struct iov_iter_ops ii_bad_ops;
extern struct iov_iter_ops ii_plain_ops;
@@ -383,8 +381,6 @@ static inline struct iov_iter_ops *iov_iter_get_ops(const struct iov_iter *iter)
case ITER_DISCARD:
return lalala;
*/
- case ITER_PAGE:
- return &ii_page_ops;
case ITER_PLAIN:
return &ii_plain_ops;
case ITER_BAD:
@@ -516,28 +512,6 @@ static inline struct bio_vec *iov_iter_bvec(struct iov_iter *i)
return (struct bio_vec *)i->data;
}
-static inline void iov_iter_init_page(struct iov_iter *i,
- struct page *page,
- size_t count, size_t written)
-{
- i->type = ITER_PAGE;
- i->data = (unsigned long)page;
- i->nr_segs = 1;
- i->iov_offset = 0;
- i->count = count + written;
-
- iov_iter_advance(i, written);
-}
-static inline int iov_iter_has_page(struct iov_iter *i)
-{
- return i->type == ITER_PAGE;
-}
-static inline struct page *iov_iter_page(struct iov_iter *i)
-{
- BUG_ON(!iov_iter_has_page(i));
- return (struct page *)i->data;
-}
-
static inline void iov_iter_init_plain(struct iov_iter *i, void *data,
size_t count, size_t written)
{
diff --git a/mm/iov-iter.c b/mm/iov-iter.c
index 04d92fb9bfcf..99ededb7f2cc 100644
--- a/mm/iov-iter.c
+++ b/mm/iov-iter.c
@@ -626,147 +626,6 @@ struct iov_iter_ops ii_bvec_ops = {
};
EXPORT_SYMBOL(ii_bvec_ops);
-/* Functions to get on with single page */
-
-static void *ii_page_kmap_atomic(const struct iov_iter *iter, void **bp,
- size_t *len)
-{
- struct page *page = (struct page *)iter->data;
- void *map;
-
- BUG_ON(iter->iov_offset >= PAGE_SIZE);
- map = kmap_atomic(page);
- *bp = map + iter->iov_offset;
- *len = iter->count;
- return map;
-}
-
-static struct page *ii_page_kmap(const struct iov_iter *iter, void **bp,
- size_t *len)
-{
- struct page *page = (struct page *)iter->data;
- void *map;
-
- BUG_ON(iter->iov_offset >= PAGE_SIZE);
- map = kmap(page);
- *bp = map + iter->iov_offset;
- *len = iter->count;
- return page;
-}
-
-static struct page *ii_page_get_page(const struct iov_iter *iter, size_t *off,
- size_t *len)
-{
- struct page *page = (struct page *)iter->data;
-
- if (!get_page_is_safe(page))
- return NULL;
-
- *off = iter->iov_offset;
- *len = iter->count;
- get_page(page);
-
- return page;
-}
-
-static size_t page_copy_tofrom_page(struct iov_iter *iter, struct page *page,
- unsigned long page_offset, size_t bytes,
- int topage)
-{
- struct page *ipage = (struct page *)iter->data;
- size_t ipage_offset = iter->iov_offset;
- void *ipage_map;
- void *page_map;
-
- BUG_ON(bytes > iter->count);
- BUG_ON(bytes > PAGE_SIZE - ipage_offset);
- BUG_ON(ipage_offset >= PAGE_SIZE);
-
- page_map = kmap_atomic(page);
- ipage_map = kmap_atomic(ipage);
-
- if (topage)
- memcpy(page_map + page_offset,
- ipage_map + ipage_offset,
- bytes);
- else
- memcpy(ipage_map + ipage_offset,
- page_map + page_offset,
- bytes);
-
- kunmap_atomic(ipage_map);
- kunmap_atomic(page_map);
-
- return bytes;
-}
-
-size_t ii_page_copy_to_user_atomic(struct page *page, struct iov_iter *i,
- unsigned long offset, size_t bytes)
-{
- return page_copy_tofrom_page(i, page, offset, bytes, 0);
-}
-size_t ii_page_copy_to_user(struct page *page, struct iov_iter *i,
- unsigned long offset, size_t bytes)
-{
- return page_copy_tofrom_page(i, page, offset, bytes, 0);
-}
-size_t ii_page_copy_from_user_atomic(struct page *page, struct iov_iter *i,
- unsigned long offset, size_t bytes)
-{
- return page_copy_tofrom_page(i, page, offset, bytes, 1);
-}
-size_t ii_page_copy_from_user(struct page *page, struct iov_iter *i,
- unsigned long offset, size_t bytes)
-{
- return page_copy_tofrom_page(i, page, offset, bytes, 1);
-}
-
-void ii_page_advance(struct iov_iter *i, size_t bytes)
-{
- BUG_ON(i->count < bytes);
- BUG_ON(i->iov_offset >= PAGE_SIZE);
- BUG_ON(bytes > PAGE_SIZE - i->iov_offset);
-
- i->iov_offset += bytes;
- i->count -= bytes;
-}
-
-/*
- * pages pointed to by bio_vecs are always pinned.
- */
-int ii_page_fault_in_readable(struct iov_iter *i, size_t bytes)
-{
- return 0;
-}
-
-size_t ii_page_single_seg_count(const struct iov_iter *i)
-{
- BUG_ON(i->nr_segs != 1);
-
- return i->count;
-}
-
-static int ii_page_shorten(struct iov_iter *i, size_t count)
-{
- return -EINVAL;
-}
-
-struct iov_iter_ops ii_page_ops = {
- .ii_copy_to_user_atomic = ii_page_copy_to_user_atomic,
- .ii_copy_to_user = ii_page_copy_to_user,
- .ii_copy_from_user_atomic = ii_page_copy_from_user_atomic,
- .ii_copy_from_user = ii_page_copy_from_user,
- .ii_advance = ii_page_advance,
- .ii_fault_in_readable = ii_page_fault_in_readable,
- .ii_single_seg_count = ii_page_single_seg_count,
- .ii_shorten = ii_page_shorten,
- .ii_kmap_atomic = ii_page_kmap_atomic,
- .ii_kmap = ii_page_kmap,
- .ii_get_page = ii_page_get_page,
-
-};
-EXPORT_SYMBOL(ii_page_ops);
-
static inline size_t ii_bad_copy_to_user_atomic(struct page *p,
struct iov_iter *i,
unsigned long off, size_t cnt)
--
2.24.3
More information about the Devel
mailing list