Skip to content

iov_iter: Add kunit tests and fix iov_iter_extract_pages()

David Howells linux-block linux-fsdevel linux-kselftest linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3iov_iter: Fix iov_iter_extract_pages()lib/iov_iter.c+15 -151 reply
2/3iov_iter: Kunit tests for copying to/from an iteratorlib/Kconfig.debug lib/Makefile lib/kunit_iov_iter.c+549 -01 reply
3/3iov_iter: Kunit tests for page extractionlib/kunit_iov_iter.c+240 -00 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by.

PatchChristoph Hellwig
1/3R-b
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] iov_iter: Add kunit tests and fix iov_iter_extract_pages()

Hi Jens, Christoph, Al,

Here are two patches to add some kunit tests for the iov_iter stuff and a patch to fix a couple of bugs found by these tests.

It's by no means comprehensive, but it does at least test the basic copy_to_iter(), copy_from_iter() and iov_iter_extract_pages() for ITER_KVEC, ITER_BVEC and ITER_XARRAY.

I've left ITER_UBUF and ITER_IOVEC untested for now as they require userspace VM interaction and I'm not sure if that's possible under kunit tests. I've also left ITER_DISCARD for the moment as that does nothing and can't be extracted.

The kunit tests should also perhaps be using folios rather than pages, but for the moment I'm using pages because I'm using vmap() and also iov_iter_extract_pages() doesn't yet have a folio equivalent.

I've pushed the patches here also:

https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=iov-fixes

David

David Howells (3):
iov_iter: Fix iov_iter_extract_pages()
iov_iter: Kunit tests for copying to/from an iterator
iov_iter: Kunit tests for page extraction

 lib/Kconfig.debug    |  11 +
 lib/Makefile         |   1 +
 lib/iov_iter.c       |  30 +-
 lib/kunit_iov_iter.c | 777 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 804 insertions(+), 15 deletions(-)
 create mode 100644 lib/kunit_iov_iter.c