diff mbox series

[RFC,08/11] iov_iter: Drop iov_iter_rw() and fold in last user

Message ID 20230630152524.661208-9-dhowells@redhat.com (mailing list archive)
State New, archived
Headers show
Series iov_iter: Use I/O direction from kiocb, iomap & request rather than iov_iter | expand

Commit Message

David Howells June 30, 2023, 3:25 p.m. UTC
Drop the last usage of iov_iter_rw() into __iov_iter_get_pages_alloc().

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Christoph Hellwig <hch@lst.de>
cc: Jens Axboe <axboe@kernel.dk>
cc: Christian Brauner <christian@brauner.io>
cc: Alexander Viro <viro@zeniv.linux.org.uk>
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
---
 include/linux/uio.h | 5 -----
 lib/iov_iter.c      | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

Comments

Christoph Hellwig July 6, 2023, 3:31 p.m. UTC | #1
On Fri, Jun 30, 2023 at 04:25:21PM +0100, David Howells wrote:
> Drop the last usage of iov_iter_rw() into __iov_iter_get_pages_alloc().

Well, if we can't just drop this check entirely, the rest of the prep
work is just churn and not actually very useful.  Shouldn't we go
all the way and kill ITER_DEST/SOURCE?
diff mbox series

Patch

diff --git a/include/linux/uio.h b/include/linux/uio.h
index ff81e5ccaef2..70e12f536f8f 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -136,11 +136,6 @@  static inline bool iov_iter_is_xarray(const struct iov_iter *i)
 	return iov_iter_type(i) == ITER_XARRAY;
 }
 
-static inline unsigned char iov_iter_rw(const struct iov_iter *i)
-{
-	return i->data_source ? WRITE : READ;
-}
-
 static inline bool user_backed_iter(const struct iov_iter *i)
 {
 	return i->user_backed;
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index b667b1e2f688..b8c52231a6ff 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1097,7 +1097,7 @@  static ssize_t __iov_iter_get_pages_alloc(struct iov_iter *i,
 		unsigned long addr;
 		int res;
 
-		if (iov_iter_rw(i) != WRITE)
+		if (i->data_source == ITER_SOURCE)
 			gup_flags |= FOLL_WRITE;
 		if (i->nofault)
 			gup_flags |= FOLL_NOFAULT;