diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2014-04-03 17:47:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:21:00 -0400 |
commit | 55881bc76faf54653a1ba71770150f13fc85739c (patch) | |
tree | 2897b4a42bba24a616b7afbb0feabfda68ab34f3 | |
parent | 6a3ed2123a78de22a9e2b2855068a8d89f8e14f4 (diff) |
fs: cachefiles: use add_to_page_cache_lru()
This code used to have its own lru cache pagevec up until a0b8cab3 ("mm:
remove lru parameter from __pagevec_lru_add and remove parts of pagevec
API"). Now it's just add_to_page_cache() followed by lru_cache_add(),
might as well use add_to_page_cache_lru() directly.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Minchan Kim <minchan@kernel.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Bob Liu <bob.liu@oracle.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Luigi Semenzato <semenzato@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Metin Doslu <metin@citusdata.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Ozgun Erdogan <ozgun@citusdata.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Roman Gushchin <klamm@yandex-team.ru>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/cachefiles/rdwr.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index ebaff368120d..4b1fb5ca65b8 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -265,24 +265,22 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object, | |||
265 | goto nomem_monitor; | 265 | goto nomem_monitor; |
266 | } | 266 | } |
267 | 267 | ||
268 | ret = add_to_page_cache(newpage, bmapping, | 268 | ret = add_to_page_cache_lru(newpage, bmapping, |
269 | netpage->index, cachefiles_gfp); | 269 | netpage->index, cachefiles_gfp); |
270 | if (ret == 0) | 270 | if (ret == 0) |
271 | goto installed_new_backing_page; | 271 | goto installed_new_backing_page; |
272 | if (ret != -EEXIST) | 272 | if (ret != -EEXIST) |
273 | goto nomem_page; | 273 | goto nomem_page; |
274 | } | 274 | } |
275 | 275 | ||
276 | /* we've installed a new backing page, so now we need to add it | 276 | /* we've installed a new backing page, so now we need to start |
277 | * to the LRU list and start it reading */ | 277 | * it reading */ |
278 | installed_new_backing_page: | 278 | installed_new_backing_page: |
279 | _debug("- new %p", newpage); | 279 | _debug("- new %p", newpage); |
280 | 280 | ||
281 | backpage = newpage; | 281 | backpage = newpage; |
282 | newpage = NULL; | 282 | newpage = NULL; |
283 | 283 | ||
284 | lru_cache_add_file(backpage); | ||
285 | |||
286 | read_backing_page: | 284 | read_backing_page: |
287 | ret = bmapping->a_ops->readpage(NULL, backpage); | 285 | ret = bmapping->a_ops->readpage(NULL, backpage); |
288 | if (ret < 0) | 286 | if (ret < 0) |
@@ -510,24 +508,23 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
510 | goto nomem; | 508 | goto nomem; |
511 | } | 509 | } |
512 | 510 | ||
513 | ret = add_to_page_cache(newpage, bmapping, | 511 | ret = add_to_page_cache_lru(newpage, bmapping, |
514 | netpage->index, cachefiles_gfp); | 512 | netpage->index, |
513 | cachefiles_gfp); | ||
515 | if (ret == 0) | 514 | if (ret == 0) |
516 | goto installed_new_backing_page; | 515 | goto installed_new_backing_page; |
517 | if (ret != -EEXIST) | 516 | if (ret != -EEXIST) |
518 | goto nomem; | 517 | goto nomem; |
519 | } | 518 | } |
520 | 519 | ||
521 | /* we've installed a new backing page, so now we need to add it | 520 | /* we've installed a new backing page, so now we need |
522 | * to the LRU list and start it reading */ | 521 | * to start it reading */ |
523 | installed_new_backing_page: | 522 | installed_new_backing_page: |
524 | _debug("- new %p", newpage); | 523 | _debug("- new %p", newpage); |
525 | 524 | ||
526 | backpage = newpage; | 525 | backpage = newpage; |
527 | newpage = NULL; | 526 | newpage = NULL; |
528 | 527 | ||
529 | lru_cache_add_file(backpage); | ||
530 | |||
531 | reread_backing_page: | 528 | reread_backing_page: |
532 | ret = bmapping->a_ops->readpage(NULL, backpage); | 529 | ret = bmapping->a_ops->readpage(NULL, backpage); |
533 | if (ret < 0) | 530 | if (ret < 0) |
@@ -538,8 +535,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
538 | monitor_backing_page: | 535 | monitor_backing_page: |
539 | _debug("- monitor add"); | 536 | _debug("- monitor add"); |
540 | 537 | ||
541 | ret = add_to_page_cache(netpage, op->mapping, netpage->index, | 538 | ret = add_to_page_cache_lru(netpage, op->mapping, |
542 | cachefiles_gfp); | 539 | netpage->index, cachefiles_gfp); |
543 | if (ret < 0) { | 540 | if (ret < 0) { |
544 | if (ret == -EEXIST) { | 541 | if (ret == -EEXIST) { |
545 | page_cache_release(netpage); | 542 | page_cache_release(netpage); |
@@ -549,8 +546,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
549 | goto nomem; | 546 | goto nomem; |
550 | } | 547 | } |
551 | 548 | ||
552 | lru_cache_add_file(netpage); | ||
553 | |||
554 | /* install a monitor */ | 549 | /* install a monitor */ |
555 | page_cache_get(netpage); | 550 | page_cache_get(netpage); |
556 | monitor->netfs_page = netpage; | 551 | monitor->netfs_page = netpage; |
@@ -613,8 +608,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
613 | backing_page_already_uptodate: | 608 | backing_page_already_uptodate: |
614 | _debug("- uptodate"); | 609 | _debug("- uptodate"); |
615 | 610 | ||
616 | ret = add_to_page_cache(netpage, op->mapping, netpage->index, | 611 | ret = add_to_page_cache_lru(netpage, op->mapping, |
617 | cachefiles_gfp); | 612 | netpage->index, cachefiles_gfp); |
618 | if (ret < 0) { | 613 | if (ret < 0) { |
619 | if (ret == -EEXIST) { | 614 | if (ret == -EEXIST) { |
620 | page_cache_release(netpage); | 615 | page_cache_release(netpage); |
@@ -631,8 +626,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
631 | 626 | ||
632 | fscache_mark_page_cached(op, netpage); | 627 | fscache_mark_page_cached(op, netpage); |
633 | 628 | ||
634 | lru_cache_add_file(netpage); | ||
635 | |||
636 | /* the netpage is unlocked and marked up to date here */ | 629 | /* the netpage is unlocked and marked up to date here */ |
637 | fscache_end_io(op, netpage, 0); | 630 | fscache_end_io(op, netpage, 0); |
638 | page_cache_release(netpage); | 631 | page_cache_release(netpage); |