diff options
author | Jérôme Glisse <jglisse@redhat.com> | 2019-04-11 14:20:30 -0400 |
---|---|---|
committer | Jérôme Glisse <jglisse@redhat.com> | 2019-04-11 16:25:38 -0400 |
commit | 68bafceddc44b2a0e15a8f715125912dc50a6928 (patch) | |
tree | 6875c7a82209d41548308af93fbd09eab8aead55 | |
parent | f5b077c08b064499e1a7072bff678bfa34623faf (diff) |
iov_iter: add helper to test if an iter would use GUP
Add an helper to test if call to iov_iter_get_pages*() with a given
iter would result in calls to GUP (get_user_pages*()). We want to
track differently page reference if they are coming from GUP and thus
we need to know when GUP is use for a given iter.
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-block@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Matthew Wilcox <willy@infradead.org>
-rw-r--r-- | include/linux/uio.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h index f184af1999a8..b12b2878a266 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -98,6 +98,17 @@ static inline bool iov_iter_bvec_no_ref(const struct iov_iter *i) return (i->type & ITER_BVEC_FLAG_NO_REF) != 0; } +/** + * iov_iter_get_pages_use_gup - true if iov_iter_get_pages(i) use GUP + * @i: iter + * Returns: true if a call to iov_iter_get_pages*() with the iter provided in + * argument would result in the use of get_user_pages*() + */ +static inline bool iov_iter_get_pages_use_gup(const struct iov_iter *i) +{ + return iov_iter_type(i) & (ITER_IOVEC | ITER_PIPE); +} + /* * Total number of bytes covered by an iovec. * |