diff mbox series

[v4,2/9] iov_iter: Add copy_folio_from_iter_atomic()

Message ID 20230710130253.3484695-3-willy@infradead.org (mailing list archive)
State Deferred, archived
Headers show
Series Create large folios in iomap buffered write path | expand

Commit Message

Matthew Wilcox July 10, 2023, 1:02 p.m. UTC
Add a folio wrapper around copy_page_from_iter_atomic().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/uio.h | 9 ++++++++-
 lib/iov_iter.c      | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig July 11, 2023, 6:31 a.m. UTC | #1
On Mon, Jul 10, 2023 at 02:02:46PM +0100, Matthew Wilcox (Oracle) wrote:
> Add a folio wrapper around copy_page_from_iter_atomic().

As mentioned in the previous patch it would probably be a lot more
obvious if the folio version was the based implementation and the
page variant the wrapper.  But I'm not going to delay the series for
it.
Matthew Wilcox July 11, 2023, 8:46 p.m. UTC | #2
On Mon, Jul 10, 2023 at 11:31:16PM -0700, Christoph Hellwig wrote:
> On Mon, Jul 10, 2023 at 02:02:46PM +0100, Matthew Wilcox (Oracle) wrote:
> > Add a folio wrapper around copy_page_from_iter_atomic().
> 
> As mentioned in the previous patch it would probably be a lot more
> obvious if the folio version was the based implementation and the
> page variant the wrapper.  But I'm not going to delay the series for
> it.

My plan for that is:

 - Add copy_folio_from_iter() wrapper
 - Convert all users
 - Convert all users of copy_page_to_iter()
 - Convert copy_page_to_iter_nofault() to copy_folio_to_iter_nofault()
   (it has one user)
 - Convert page_copy_sane() to folio_copy_sane()

But this is pretty low priority compared to all the other page->folio
conversions that need to happen.  So many filesystems ...
Darrick J. Wong July 24, 2023, 3:56 p.m. UTC | #3
On Mon, Jul 10, 2023 at 02:02:46PM +0100, Matthew Wilcox (Oracle) wrote:
> Add a folio wrapper around copy_page_from_iter_atomic().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Wellllll crap.  I got all ready to push this to for-next, but then my
maintainer checkpatch interlock scripts pointed out that this commit
doesn't have /any/ RVB attached to it.  Apparently I forgot to tag this
one when I went through all this.

Matthew, can you please add:

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

and redo the whole branch-push and pull-request dance, please?

(Also could you put a sob tag on the tag message so that the merge
commit can have full authorship details?)

--D

> ---
>  include/linux/uio.h | 9 ++++++++-
>  lib/iov_iter.c      | 2 +-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/uio.h b/include/linux/uio.h
> index ff81e5ccaef2..42bce38a8e87 100644
> --- a/include/linux/uio.h
> +++ b/include/linux/uio.h
> @@ -163,7 +163,7 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
>  	return ret;
>  }
>  
> -size_t copy_page_from_iter_atomic(struct page *page, unsigned offset,
> +size_t copy_page_from_iter_atomic(struct page *page, size_t offset,
>  				  size_t bytes, struct iov_iter *i);
>  void iov_iter_advance(struct iov_iter *i, size_t bytes);
>  void iov_iter_revert(struct iov_iter *i, size_t bytes);
> @@ -184,6 +184,13 @@ static inline size_t copy_folio_to_iter(struct folio *folio, size_t offset,
>  {
>  	return copy_page_to_iter(&folio->page, offset, bytes, i);
>  }
> +
> +static inline size_t copy_folio_from_iter_atomic(struct folio *folio,
> +		size_t offset, size_t bytes, struct iov_iter *i)
> +{
> +	return copy_page_from_iter_atomic(&folio->page, offset, bytes, i);
> +}
> +
>  size_t copy_page_to_iter_nofault(struct page *page, unsigned offset,
>  				 size_t bytes, struct iov_iter *i);
>  
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index c728b6e4fb18..8da566a549ad 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -566,7 +566,7 @@ size_t iov_iter_zero(size_t bytes, struct iov_iter *i)
>  }
>  EXPORT_SYMBOL(iov_iter_zero);
>  
> -size_t copy_page_from_iter_atomic(struct page *page, unsigned offset,
> +size_t copy_page_from_iter_atomic(struct page *page, size_t offset,
>  		size_t bytes, struct iov_iter *i)
>  {
>  	size_t n, copied = 0;
> -- 
> 2.39.2
>
diff mbox series

Patch

diff --git a/include/linux/uio.h b/include/linux/uio.h
index ff81e5ccaef2..42bce38a8e87 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -163,7 +163,7 @@  static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
 	return ret;
 }
 
-size_t copy_page_from_iter_atomic(struct page *page, unsigned offset,
+size_t copy_page_from_iter_atomic(struct page *page, size_t offset,
 				  size_t bytes, struct iov_iter *i);
 void iov_iter_advance(struct iov_iter *i, size_t bytes);
 void iov_iter_revert(struct iov_iter *i, size_t bytes);
@@ -184,6 +184,13 @@  static inline size_t copy_folio_to_iter(struct folio *folio, size_t offset,
 {
 	return copy_page_to_iter(&folio->page, offset, bytes, i);
 }
+
+static inline size_t copy_folio_from_iter_atomic(struct folio *folio,
+		size_t offset, size_t bytes, struct iov_iter *i)
+{
+	return copy_page_from_iter_atomic(&folio->page, offset, bytes, i);
+}
+
 size_t copy_page_to_iter_nofault(struct page *page, unsigned offset,
 				 size_t bytes, struct iov_iter *i);
 
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index c728b6e4fb18..8da566a549ad 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -566,7 +566,7 @@  size_t iov_iter_zero(size_t bytes, struct iov_iter *i)
 }
 EXPORT_SYMBOL(iov_iter_zero);
 
-size_t copy_page_from_iter_atomic(struct page *page, unsigned offset,
+size_t copy_page_from_iter_atomic(struct page *page, size_t offset,
 		size_t bytes, struct iov_iter *i)
 {
 	size_t n, copied = 0;