aboutsummaryrefslogtreecommitdiff
path: root/fs/splice.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-04-20 08:17:04 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-20 08:17:04 -0700
commit402a26f0c040077ed6f941eefac5a6971f0d5f40 (patch)
treef74e5d732404e9716b3c753007bac0f5d1e92869 /fs/splice.c
parentbf7cf6ee1bd00679bbe93b6ae73f80032759b8df (diff)
parent4f73247f0e53be1bd4aa519476e6261a8e4a64ab (diff)
Merge branch 'for-linus' of git://brick.kernel.dk/data/git/linux-2.6-block
* 'for-linus' of git://brick.kernel.dk/data/git/linux-2.6-block: [PATCH] block/elevator.c: remove unused exports [PATCH] splice: fix smaller sized splice reads [PATCH] Don't inherit ->splice_pipe across forks [patch] cleanup: use blk_queue_stopped [PATCH] Document online io scheduler switching
Diffstat (limited to 'fs/splice.c')
-rw-r--r--fs/splice.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 22fac87e90b..0559e7577a0 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -275,6 +275,15 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
error = 0;
bytes = 0;
for (i = 0; i < nr_pages; i++, index++) {
+ unsigned int this_len;
+
+ if (!len)
+ break;
+
+ /*
+ * this_len is the max we'll use from this page
+ */
+ this_len = min(len, PAGE_CACHE_SIZE - loff);
find_page:
/*
* lookup the page for this index
@@ -366,11 +375,13 @@ readpage:
* force quit after adding this page
*/
nr_pages = i;
+ this_len = min(this_len, loff);
}
}
fill_it:
pages[i] = page;
- bytes += PAGE_CACHE_SIZE - loff;
+ bytes += this_len;
+ len -= this_len;
loff = 0;
}