mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[PATCH] splice: fix smaller sized splice reads
Signed-off-by: Jens Axboe <axboe@suse.de>
This commit is contained in:
parent
a0aa7f68af
commit
82aa5d6183
1 changed files with 12 additions and 1 deletions
13
fs/splice.c
13
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue