Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 85888
b: refs/heads/master
c: 40b01b9
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jens Axboe committed Feb 19, 2008
1 parent 7b88cee commit 235272c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 56c819df77f96c3fc0c2a979e12b478403728790
refs/heads/master: 40b01b9bbdf51ae543a04744283bf2d56c4a6afa
17 changes: 17 additions & 0 deletions trunk/block/blk-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
ubuf += ret;
}

/*
* __blk_rq_map_user() copies the buffers if starting address
* or length isn't aligned. As the copied buffer is always
* page aligned, we know that there's enough room for padding.
* Extend the last bio and update rq->data_len accordingly.
*
* On unmap, bio_uncopy_user() will use unmodified
* bio_map_data pointed to by bio->bi_private.
*/
if (len & queue_dma_alignment(q)) {
unsigned int pad_len = (queue_dma_alignment(q) & ~len) + 1;
struct bio *bio = rq->biotail;

bio->bi_io_vec[bio->bi_vcnt - 1].bv_len += pad_len;
bio->bi_size += pad_len;
}

rq->buffer = rq->data = NULL;
return 0;
unmap_rq:
Expand Down

0 comments on commit 235272c

Please sign in to comment.