Commit a89555fb authored by Badari Pulavarty's avatar Badari Pulavarty Committed by Linus Torvalds

[PATCH] direct-io: size the BIOs more accurately

We're being lazy when calculating the size of the needed BIO, allocating
two extra pages to cope with funny alignments.

Change that to be exact, thus allocating smaller BIOs someties.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 41556780
......@@ -954,8 +954,12 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
dio->waiter = NULL;
dio->pages_in_io = 0;
for (seg = 0; seg < nr_segs; seg++)
dio->pages_in_io += (iov[seg].iov_len >> blkbits) + 2;
for (seg = 0; seg < nr_segs; seg++) {
user_addr = (unsigned long)iov[seg].iov_base;
dio->pages_in_io +=
((user_addr+iov[seg].iov_len +PAGE_SIZE-1)/PAGE_SIZE
- user_addr/PAGE_SIZE);
}
for (seg = 0; seg < nr_segs; seg++) {
user_addr = (unsigned long)iov[seg].iov_base;
......
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