diff options
author | Chen, Kenneth W <kenneth.w.chen@intel.com> | 2007-01-22 23:40:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-23 10:52:06 -0500 |
commit | cda9205da24aeaa8fb086b0fb85cdf39571ecc3f (patch) | |
tree | c302c3d0b0558d3fc5ac0b5750e4f8150517ece5 /fs | |
parent | 15c945c3d0913d73a7d57d7a0a3c4e2902598cc6 (diff) |
[PATCH] fix blk_direct_IO bio preparation
For large size DIO that needs multiple bio, one full page worth of data was
lost at the boundary of bio's maximum sector or segment limits. After a
bio is full and got submitted. The outer while (nbytes) { ... } loop will
allocate a new bio and just march on to index into next page. It just
forgets about the page that bio_add_page() rejected when previous bio is
full. Fix it by put the rejected page back to pvec so we pick it up again
for the next bio.
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index da020be25dd2..d9bdf2b3ade2 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -190,6 +190,12 @@ static struct page *blk_get_page(unsigned long addr, size_t count, int rw, | |||
190 | return pvec->page[pvec->idx++]; | 190 | return pvec->page[pvec->idx++]; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* return a page back to pvec array */ | ||
194 | static void blk_unget_page(struct page *page, struct pvec *pvec) | ||
195 | { | ||
196 | pvec->page[--pvec->idx] = page; | ||
197 | } | ||
198 | |||
193 | static ssize_t | 199 | static ssize_t |
194 | blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | 200 | blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, |
195 | loff_t pos, unsigned long nr_segs) | 201 | loff_t pos, unsigned long nr_segs) |
@@ -278,6 +284,8 @@ same_bio: | |||
278 | count = min(count, nbytes); | 284 | count = min(count, nbytes); |
279 | goto same_bio; | 285 | goto same_bio; |
280 | } | 286 | } |
287 | } else { | ||
288 | blk_unget_page(page, &pvec); | ||
281 | } | 289 | } |
282 | 290 | ||
283 | /* bio is ready, submit it */ | 291 | /* bio is ready, submit it */ |