Subject: linux-next: manual merge of the block tree with the mm tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 23 Mar 2023 10:02:04 +1100

Hi all,

Today's linux-next merge of the block tree got a conflict in:

  lib/iov_iter.c

between commit:

  c4cf24ce34b7 ("iov_iter: add copy_page_to_iter_atomic()")

from the mm tree and commit:

  a53f5dee3448 ("iov_iter: Kill ITER_PIPE")

from the block tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc lib/iov_iter.c
index 48ca1c5dfc04,fad95e4cf372..000000000000
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@@ -821,60 -532,6 +532,34 @@@ size_t copy_page_from_iter_atomic(struc
  }
  EXPORT_SYMBOL(copy_page_from_iter_atomic);
  
 +size_t copy_page_to_iter_atomic(struct page *page, unsigned offset, size_t bytes,
 +				struct iov_iter *i)
 +{
 +	char *kaddr = kmap_local_page(page);
 +	char *p = kaddr + offset;
 +	size_t copied = 0;
 +
 +	if (!page_copy_sane(page, offset, bytes) ||
 +	    WARN_ON_ONCE(i->data_source))
 +		goto out;
 +
 +	if (unlikely(iov_iter_is_pipe(i))) {
 +		copied = copy_page_to_iter_pipe(page, offset, bytes, i);
 +		goto out;
 +	}
 +
 +	iterate_and_advance(i, bytes, base, len, off,
 +		copyout(base, p + off, len),
 +		memcpy(base, p + off, len)
 +	)
 +	copied = bytes;
 +
 +out:
 +	kunmap_local(kaddr);
 +	return copied;
 +}
 +EXPORT_SYMBOL(copy_page_to_iter_atomic);
 +
- static void pipe_advance(struct iov_iter *i, size_t size)
- {
- 	struct pipe_inode_info *pipe = i->pipe;
- 	int off = i->last_offset;
- 
- 	if (!off && !size) {
- 		pipe_discard_from(pipe, i->start_head); // discard everything
- 		return;
- 	}
- 	i->count -= size;
- 	while (1) {
- 		struct pipe_buffer *buf = pipe_buf(pipe, i->head);
- 		if (off) /* make it relative to the beginning of buffer */
- 			size += abs(off) - buf->offset;
- 		if (size <= buf->len) {
- 			buf->len = size;
- 			i->last_offset = last_offset(buf);
- 			break;
- 		}
- 		size -= buf->len;
- 		i->head++;
- 		off = 0;
- 	}
- 	pipe_discard_from(pipe, i->head + 1); // discard everything past this one
- }
- 
  static void iov_iter_bvec_advance(struct iov_iter *i, size_t size)
  {
  	const struct bio_vec *bvec, *end;