aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBadari Pulavarty <pbadari@us.ibm.com>2004-08-22 23:04:26 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-22 23:04:26 -0700
commita89555fb28ccb7d1fbedf4861efe4ede8fdad5aa (patch)
tree509414053801379f189a8534dd8722eb9db853c7 /fs
parent41556780ed65b58645095589133dc42c8b9570e9 (diff)
downloadhistory-a89555fb28ccb7d1fbedf4861efe4ede8fdad5aa.tar.gz
[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: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/direct-io.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 37f593c42e5665..20405c7844999d 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -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;