[RFC PATCH 08/11] iov_iter: Drop iov_iter_rw() and fold in last user
From: David Howells
Date: Fri Jun 30 2023 - 11:28:39 EST
Drop the last usage of iov_iter_rw() into __iov_iter_get_pages_alloc().
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Christoph Hellwig <hch@xxxxxx>
cc: Jens Axboe <axboe@xxxxxxxxx>
cc: Christian Brauner <christian@xxxxxxxxxx>
cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
cc: linux-block@xxxxxxxxxxxxxxx
cc: linux-fsdevel@xxxxxxxxxxxxxxx
---
include/linux/uio.h | 5 -----
lib/iov_iter.c | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)
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;