aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cachefiles/rdwr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cachefiles/rdwr.c')
-rw-r--r--fs/cachefiles/rdwr.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 317f9ee9c991..ebaff368120d 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -12,6 +12,7 @@
12#include <linux/mount.h> 12#include <linux/mount.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/file.h> 14#include <linux/file.h>
15#include <linux/swap.h>
15#include "internal.h" 16#include "internal.h"
16 17
17/* 18/*
@@ -227,8 +228,7 @@ static void cachefiles_read_copier(struct fscache_operation *_op)
227 */ 228 */
228static int cachefiles_read_backing_file_one(struct cachefiles_object *object, 229static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
229 struct fscache_retrieval *op, 230 struct fscache_retrieval *op,
230 struct page *netpage, 231 struct page *netpage)
231 struct pagevec *pagevec)
232{ 232{
233 struct cachefiles_one_read *monitor; 233 struct cachefiles_one_read *monitor;
234 struct address_space *bmapping; 234 struct address_space *bmapping;
@@ -237,8 +237,6 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
237 237
238 _enter(""); 238 _enter("");
239 239
240 pagevec_reinit(pagevec);
241
242 _debug("read back %p{%lu,%d}", 240 _debug("read back %p{%lu,%d}",
243 netpage, netpage->index, page_count(netpage)); 241 netpage, netpage->index, page_count(netpage));
244 242
@@ -283,9 +281,7 @@ installed_new_backing_page:
283 backpage = newpage; 281 backpage = newpage;
284 newpage = NULL; 282 newpage = NULL;
285 283
286 page_cache_get(backpage); 284 lru_cache_add_file(backpage);
287 pagevec_add(pagevec, backpage);
288 __pagevec_lru_add_file(pagevec);
289 285
290read_backing_page: 286read_backing_page:
291 ret = bmapping->a_ops->readpage(NULL, backpage); 287 ret = bmapping->a_ops->readpage(NULL, backpage);
@@ -452,8 +448,7 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op,
452 if (block) { 448 if (block) {
453 /* submit the apparently valid page to the backing fs to be 449 /* submit the apparently valid page to the backing fs to be
454 * read from disk */ 450 * read from disk */
455 ret = cachefiles_read_backing_file_one(object, op, page, 451 ret = cachefiles_read_backing_file_one(object, op, page);
456 &pagevec);
457 } else if (cachefiles_has_space(cache, 0, 1) == 0) { 452 } else if (cachefiles_has_space(cache, 0, 1) == 0) {
458 /* there's space in the cache we can use */ 453 /* there's space in the cache we can use */
459 fscache_mark_page_cached(op, page); 454 fscache_mark_page_cached(op, page);
@@ -482,14 +477,11 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
482{ 477{
483 struct cachefiles_one_read *monitor = NULL; 478 struct cachefiles_one_read *monitor = NULL;
484 struct address_space *bmapping = object->backer->d_inode->i_mapping; 479 struct address_space *bmapping = object->backer->d_inode->i_mapping;
485 struct pagevec lru_pvec;
486 struct page *newpage = NULL, *netpage, *_n, *backpage = NULL; 480 struct page *newpage = NULL, *netpage, *_n, *backpage = NULL;
487 int ret = 0; 481 int ret = 0;
488 482
489 _enter(""); 483 _enter("");
490 484
491 pagevec_init(&lru_pvec, 0);
492
493 list_for_each_entry_safe(netpage, _n, list, lru) { 485 list_for_each_entry_safe(netpage, _n, list, lru) {
494 list_del(&netpage->lru); 486 list_del(&netpage->lru);
495 487
@@ -534,9 +526,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
534 backpage = newpage; 526 backpage = newpage;
535 newpage = NULL; 527 newpage = NULL;
536 528
537 page_cache_get(backpage); 529 lru_cache_add_file(backpage);
538 if (!pagevec_add(&lru_pvec, backpage))
539 __pagevec_lru_add_file(&lru_pvec);
540 530
541 reread_backing_page: 531 reread_backing_page:
542 ret = bmapping->a_ops->readpage(NULL, backpage); 532 ret = bmapping->a_ops->readpage(NULL, backpage);
@@ -559,9 +549,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
559 goto nomem; 549 goto nomem;
560 } 550 }
561 551
562 page_cache_get(netpage); 552 lru_cache_add_file(netpage);
563 if (!pagevec_add(&lru_pvec, netpage))
564 __pagevec_lru_add_file(&lru_pvec);
565 553
566 /* install a monitor */ 554 /* install a monitor */
567 page_cache_get(netpage); 555 page_cache_get(netpage);
@@ -643,9 +631,7 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
643 631
644 fscache_mark_page_cached(op, netpage); 632 fscache_mark_page_cached(op, netpage);
645 633
646 page_cache_get(netpage); 634 lru_cache_add_file(netpage);
647 if (!pagevec_add(&lru_pvec, netpage))
648 __pagevec_lru_add_file(&lru_pvec);
649 635
650 /* the netpage is unlocked and marked up to date here */ 636 /* the netpage is unlocked and marked up to date here */
651 fscache_end_io(op, netpage, 0); 637 fscache_end_io(op, netpage, 0);
@@ -661,8 +647,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
661 647
662out: 648out:
663 /* tidy up */ 649 /* tidy up */
664 pagevec_lru_add_file(&lru_pvec);
665
666 if (newpage) 650 if (newpage)
667 page_cache_release(newpage); 651 page_cache_release(newpage);
668 if (netpage) 652 if (netpage)