Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127880
b: refs/heads/master
c: 56c451f
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Jan 2, 2009
1 parent 42aef75 commit f9a2b8e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e623ddb4e940b266adc77ba1cc28a3554aa90e79
refs/heads/master: 56c451f4b583ccdf80c9e676179c9cb49de86745
3 changes: 3 additions & 0 deletions trunk/block/blk-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
bio = rq->bio;
bytes_read += ret;
ubuf += ret;

if (map_data)
map_data->offset += ret;
}

if (!bio_flagged(bio, BIO_USER_MAPPED))
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,6 +1669,7 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd)
md->pages = req_schp->pages;
md->page_order = req_schp->page_order;
md->nr_entries = req_schp->k_use_sg;
md->offset = 0;
}

if (iov_count)
Expand Down
12 changes: 9 additions & 3 deletions trunk/fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
int i, ret;
int nr_pages = 0;
unsigned int len = 0;
unsigned int offset = map_data ? map_data->offset & ~PAGE_MASK : 0;

for (i = 0; i < iov_count; i++) {
unsigned long uaddr;
Expand All @@ -814,12 +815,16 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
bio->bi_rw |= (!write_to_vm << BIO_RW);

ret = 0;
i = 0;
if (map_data)

if (map_data) {
nr_pages = 1 << map_data->page_order;
i = map_data->offset / PAGE_SIZE;
}
while (len) {
unsigned int bytes = PAGE_SIZE;

bytes -= offset;

if (bytes > len)
bytes = len;

Expand All @@ -841,10 +846,11 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
}
}

if (bio_add_pc_page(q, bio, page, bytes, 0) < bytes)
if (bio_add_pc_page(q, bio, page, bytes, offset) < bytes)
break;

len -= bytes;
offset = 0;
}

if (ret)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ struct rq_map_data {
struct page **pages;
int page_order;
int nr_entries;
unsigned long offset;
};

struct req_iterator {
Expand Down

0 comments on commit f9a2b8e

Please sign in to comment.