Skip to content

Commit f1b4cb6

Browse files
dhowellsbrauner
authored andcommitted
iov_iter: Derive user-backedness from the iterator type
Use the iterator type to determine whether an iterator is user-backed or not rather than using a special flag for it. Now that ITER_UBUF and ITER_IOVEC are 0 and 1, they can be checked with a single comparison. Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/r/[email protected] cc: Alexander Viro <[email protected]> cc: Jens Axboe <[email protected]> cc: Christoph Hellwig <[email protected]> cc: Christian Brauner <[email protected]> cc: Matthew Wilcox <[email protected]> cc: Linus Torvalds <[email protected]> cc: David Laight <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 7d9e44a commit f1b4cb6

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

include/linux/uio.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct iov_iter {
4343
bool copy_mc;
4444
bool nofault;
4545
bool data_source;
46-
bool user_backed;
4746
size_t iov_offset;
4847
/*
4948
* Hack alert: overlay ubuf_iovec with iovec + count, so
@@ -140,7 +139,7 @@ static inline unsigned char iov_iter_rw(const struct iov_iter *i)
140139

141140
static inline bool user_backed_iter(const struct iov_iter *i)
142141
{
143-
return i->user_backed;
142+
return iter_is_ubuf(i) || iter_is_iovec(i);
144143
}
145144

146145
/*
@@ -380,7 +379,6 @@ static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,
380379
*i = (struct iov_iter) {
381380
.iter_type = ITER_UBUF,
382381
.copy_mc = false,
383-
.user_backed = true,
384382
.data_source = direction,
385383
.ubuf = buf,
386384
.count = count,

lib/iov_iter.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ void iov_iter_init(struct iov_iter *i, unsigned int direction,
290290
.iter_type = ITER_IOVEC,
291291
.copy_mc = false,
292292
.nofault = false,
293-
.user_backed = true,
294293
.data_source = direction,
295294
.__iov = iov,
296295
.nr_segs = nr_segs,

0 commit comments

Comments
 (0)