Skip to content

Commit

Permalink
bio: use offset_in_page macro
Browse files Browse the repository at this point in the history
Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Geliang Tang authored and Jens Axboe committed Nov 24, 2015
1 parent 1fe8f34 commit bd5cece
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
int i, ret;
int nr_pages = 0;
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++) {
unsigned long uaddr;
Expand Down Expand Up @@ -1304,7 +1304,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
goto out_unmap;
}

offset = uaddr & ~PAGE_MASK;
offset = offset_in_page(uaddr);
for (j = cur_page; j < page_limit; j++) {
unsigned int bytes = PAGE_SIZE - offset;

Expand Down

0 comments on commit bd5cece

Please sign in to comment.