Commit f3256075 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: remove the BIO_NULL_MAPPED flag

We can simply use a boolean flag in the bio_map_data data structure
instead.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c13f0fbc
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
#include "blk.h" #include "blk.h"
struct bio_map_data { struct bio_map_data {
int is_our_pages; bool is_our_pages : 1;
bool is_null_mapped : 1;
struct iov_iter iter; struct iov_iter iter;
struct iovec iov[]; struct iovec iov[];
}; };
...@@ -108,7 +109,7 @@ static int bio_uncopy_user(struct bio *bio) ...@@ -108,7 +109,7 @@ static int bio_uncopy_user(struct bio *bio)
struct bio_map_data *bmd = bio->bi_private; struct bio_map_data *bmd = bio->bi_private;
int ret = 0; int ret = 0;
if (!bio_flagged(bio, BIO_NULL_MAPPED)) { if (!bmd || !bmd->is_null_mapped) {
/* /*
* if we're in a workqueue, the request is orphaned, so * if we're in a workqueue, the request is orphaned, so
* don't copy into a random user address space, just free * don't copy into a random user address space, just free
...@@ -158,7 +159,7 @@ static struct bio *bio_copy_user_iov(struct request_queue *q, ...@@ -158,7 +159,7 @@ static struct bio *bio_copy_user_iov(struct request_queue *q,
* The caller provided iov might point to an on-stack or otherwise * The caller provided iov might point to an on-stack or otherwise
* shortlived one. * shortlived one.
*/ */
bmd->is_our_pages = map_data ? 0 : 1; bmd->is_our_pages = !map_data;
nr_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE); nr_pages = DIV_ROUND_UP(offset + len, PAGE_SIZE);
if (nr_pages > BIO_MAX_PAGES) if (nr_pages > BIO_MAX_PAGES)
...@@ -234,7 +235,7 @@ static struct bio *bio_copy_user_iov(struct request_queue *q, ...@@ -234,7 +235,7 @@ static struct bio *bio_copy_user_iov(struct request_queue *q,
bio->bi_private = bmd; bio->bi_private = bmd;
if (map_data && map_data->null_mapped) if (map_data && map_data->null_mapped)
bio_set_flag(bio, BIO_NULL_MAPPED); bmd->is_null_mapped = true;
return bio; return bio;
cleanup: cleanup:
if (!map_data) if (!map_data)
......
...@@ -257,7 +257,6 @@ enum { ...@@ -257,7 +257,6 @@ enum {
BIO_CLONED, /* doesn't own data */ BIO_CLONED, /* doesn't own data */
BIO_BOUNCED, /* bio is a bounce bio */ BIO_BOUNCED, /* bio is a bounce bio */
BIO_USER_MAPPED, /* contains user pages */ BIO_USER_MAPPED, /* contains user pages */
BIO_NULL_MAPPED, /* contains invalid user pages */
BIO_WORKINGSET, /* contains userspace workingset pages */ BIO_WORKINGSET, /* contains userspace workingset pages */
BIO_QUIET, /* Make BIO Quiet */ BIO_QUIET, /* Make BIO Quiet */
BIO_CHAIN, /* chained bio, ->bi_remaining in effect */ BIO_CHAIN, /* chained bio, ->bi_remaining in effect */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment