@@ -1244,11 +1244,11 @@ static int bio_iov_add_zone_append_page(struct bio *bio, struct page *page,
*/
static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
{
+ iov_iter_extraction_t extraction_flags = 0;
unsigned short nr_pages = bio->bi_max_vecs - bio->bi_vcnt;
unsigned short entries_left = bio->bi_max_vecs - bio->bi_vcnt;
struct bio_vec *bv = bio->bi_io_vec + bio->bi_vcnt;
struct page **pages = (struct page **)bv;
- unsigned int extraction_flags = 0;
ssize_t size, left;
unsigned len, i = 0;
size_t offset, trim;
@@ -265,9 +265,9 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
gfp_t gfp_mask)
{
+ iov_iter_extraction_t extraction_flags = 0;
unsigned int max_sectors = queue_max_hw_sectors(rq->q);
unsigned int nr_vecs = iov_iter_npages(iter, BIO_MAX_VECS);
- unsigned int extraction_flags = 0;
struct bio *bio;
int ret;
int j;
@@ -13,6 +13,8 @@
struct page;
struct pipe_inode_info;
+typedef unsigned int iov_iter_extraction_t;
+
struct kvec {
void *iov_base; /* and that should *never* hold a userland pointer */
size_t iov_len;
@@ -252,12 +254,12 @@ void iov_iter_xarray(struct iov_iter *i, unsigned int direction, struct xarray *
loff_t start, size_t count);
ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
size_t maxsize, unsigned maxpages, size_t *start,
- unsigned extraction_flags);
+ iov_iter_extraction_t extraction_flags);
ssize_t iov_iter_get_pages2(struct iov_iter *i, struct page **pages,
size_t maxsize, unsigned maxpages, size_t *start);
ssize_t iov_iter_get_pages_alloc(struct iov_iter *i,
struct page ***pages, size_t maxsize, size_t *start,
- unsigned extraction_flags);
+ iov_iter_extraction_t extraction_flags);
ssize_t iov_iter_get_pages_alloc2(struct iov_iter *i, struct page ***pages,
size_t maxsize, size_t *start);
int iov_iter_npages(const struct iov_iter *i, int maxpages);
@@ -359,13 +361,14 @@ static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,
.count = count
};
}
-
/* Flags for iov_iter_get/extract_pages*() */
-#define ITER_ALLOW_P2PDMA 0x01 /* Allow P2PDMA on the extracted pages */
+/* Allow P2PDMA on the extracted pages */
+#define ITER_ALLOW_P2PDMA ((__force iov_iter_extraction_t)0x01)
ssize_t iov_iter_extract_pages(struct iov_iter *i, struct page ***pages,
size_t maxsize, unsigned int maxpages,
- unsigned int extraction_flags, size_t *offset0);
+ iov_iter_extraction_t extraction_flags,
+ size_t *offset0);
/**
* iov_iter_extract_will_pin - Indicate how pages from the iterator will be retained
@@ -1432,7 +1432,7 @@ static struct page *first_bvec_segment(const struct iov_iter *i,
static ssize_t __iov_iter_get_pages_alloc(struct iov_iter *i,
struct page ***pages, size_t maxsize,
unsigned int maxpages, size_t *start,
- unsigned int extraction_flags)
+ iov_iter_extraction_t extraction_flags)
{
unsigned int n, gup_flags = 0;
@@ -1929,7 +1929,7 @@ void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state)
static ssize_t iov_iter_extract_pipe_pages(struct iov_iter *i,
struct page ***pages, size_t maxsize,
unsigned int maxpages,
- unsigned int extraction_flags,
+ iov_iter_extraction_t extraction_flags,
size_t *offset0)
{
unsigned int nr, offset, chunk, j;
@@ -1971,7 +1971,7 @@ static ssize_t iov_iter_extract_pipe_pages(struct iov_iter *i,
static ssize_t iov_iter_extract_xarray_pages(struct iov_iter *i,
struct page ***pages, size_t maxsize,
unsigned int maxpages,
- unsigned int extraction_flags,
+ iov_iter_extraction_t extraction_flags,
size_t *offset0)
{
struct page *page, **p;
@@ -2017,7 +2017,7 @@ static ssize_t iov_iter_extract_xarray_pages(struct iov_iter *i,
static ssize_t iov_iter_extract_bvec_pages(struct iov_iter *i,
struct page ***pages, size_t maxsize,
unsigned int maxpages,
- unsigned int extraction_flags,
+ iov_iter_extraction_t extraction_flags,
size_t *offset0)
{
struct page **p, *page;
@@ -2060,7 +2060,7 @@ static ssize_t iov_iter_extract_bvec_pages(struct iov_iter *i,
static ssize_t iov_iter_extract_kvec_pages(struct iov_iter *i,
struct page ***pages, size_t maxsize,
unsigned int maxpages,
- unsigned int extraction_flags,
+ iov_iter_extraction_t extraction_flags,
size_t *offset0)
{
struct page **p, *page;
@@ -2125,7 +2125,7 @@ static ssize_t iov_iter_extract_user_pages(struct iov_iter *i,
struct page ***pages,
size_t maxsize,
unsigned int maxpages,
- unsigned int extraction_flags,
+ iov_iter_extraction_t extraction_flags,
size_t *offset0)
{
unsigned long addr;
@@ -2207,7 +2207,7 @@ ssize_t iov_iter_extract_pages(struct iov_iter *i,
struct page ***pages,
size_t maxsize,
unsigned int maxpages,
- unsigned int extraction_flags,
+ iov_iter_extraction_t extraction_flags,
size_t *offset0)
{
maxsize = min_t(size_t, min_t(size_t, maxsize, i->count), MAX_RW_COUNT);