Commit bd5cecea authored by Geliang Tang's avatar Geliang Tang Committed by Jens Axboe

bio: use offset_in_page macro

Use offset_in_page macro instead of (addr & ~PAGE_MASK).
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 1fe8f348
...@@ -1125,7 +1125,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q, ...@@ -1125,7 +1125,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
int i, ret; int i, ret;
int nr_pages = 0; int nr_pages = 0;
unsigned int len = iter->count; unsigned int len = iter->count;
unsigned int offset = map_data ? map_data->offset & ~PAGE_MASK : 0; unsigned int offset = map_data ? offset_in_page(map_data->offset) : 0;
for (i = 0; i < iter->nr_segs; i++) { for (i = 0; i < iter->nr_segs; i++) {
unsigned long uaddr; unsigned long uaddr;
...@@ -1304,7 +1304,7 @@ struct bio *bio_map_user_iov(struct request_queue *q, ...@@ -1304,7 +1304,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
goto out_unmap; goto out_unmap;
} }
offset = uaddr & ~PAGE_MASK; offset = offset_in_page(uaddr);
for (j = cur_page; j < page_limit; j++) { for (j = cur_page; j < page_limit; j++) {
unsigned int bytes = PAGE_SIZE - offset; unsigned int bytes = PAGE_SIZE - offset;
......
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