diff options
-rw-r--r-- | fs/splice.c | 99 | ||||
-rw-r--r-- | include/linux/pagemap.h | 2 | ||||
-rw-r--r-- | mm/filemap.c | 32 |
3 files changed, 101 insertions, 32 deletions
diff --git a/fs/splice.c b/fs/splice.c index 447ebc0a37f3..a46ddd28561e 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -279,7 +279,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, | |||
279 | pgoff_t index, end_index; | 279 | pgoff_t index, end_index; |
280 | loff_t isize; | 280 | loff_t isize; |
281 | size_t total_len; | 281 | size_t total_len; |
282 | int error; | 282 | int error, page_nr; |
283 | struct splice_pipe_desc spd = { | 283 | struct splice_pipe_desc spd = { |
284 | .pages = pages, | 284 | .pages = pages, |
285 | .partial = partial, | 285 | .partial = partial, |
@@ -299,47 +299,75 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, | |||
299 | * read-ahead if this is a non-zero offset (we are likely doing small | 299 | * read-ahead if this is a non-zero offset (we are likely doing small |
300 | * chunk splice and the page is already there) for a single page. | 300 | * chunk splice and the page is already there) for a single page. |
301 | */ | 301 | */ |
302 | if (!loff || spd.nr_pages > 1) | 302 | if (!loff || nr_pages > 1) |
303 | do_page_cache_readahead(mapping, in, index, spd.nr_pages); | 303 | page_cache_readahead(mapping, &in->f_ra, in, index, nr_pages); |
304 | 304 | ||
305 | /* | 305 | /* |
306 | * Now fill in the holes: | 306 | * Now fill in the holes: |
307 | */ | 307 | */ |
308 | error = 0; | 308 | error = 0; |
309 | total_len = 0; | 309 | total_len = 0; |
310 | for (spd.nr_pages = 0; spd.nr_pages < nr_pages; spd.nr_pages++, index++) { | ||
311 | unsigned int this_len; | ||
312 | 310 | ||
313 | if (!len) | 311 | /* |
314 | break; | 312 | * Lookup the (hopefully) full range of pages we need. |
313 | */ | ||
314 | spd.nr_pages = find_get_pages_contig(mapping, index, nr_pages, pages); | ||
315 | 315 | ||
316 | /* | ||
317 | * If find_get_pages_contig() returned fewer pages than we needed, | ||
generated by cgit v1.2.2 (git 2.25.0) at 2025-09-20 17:45:14 -0400 |