Messages in this thread Patch in this message | | | From | jglisse@redhat ... | Subject | [PATCH v1 02/15] iov_iter: add helper to test if an iter would use GUP | Date | Thu, 11 Apr 2019 17:08:21 -0400 |
| |
From: Jérôme Glisse <jglisse@redhat.com>
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> --- include/linux/uio.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
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. * -- 2.20.1
| |