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>
This commit is contained in:
Johannes Weiner 2014-04-03 14:47:36 -07:00 коммит произвёл Linus Torvalds
Родитель 6a3ed2123a
Коммит 55881bc76f
1 изменённых файлов: 13 добавлений и 20 удалений

Просмотреть файл

@ -265,24 +265,22 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
goto nomem_monitor; goto nomem_monitor;
} }
ret = add_to_page_cache(newpage, bmapping, ret = add_to_page_cache_lru(newpage, bmapping,
netpage->index, cachefiles_gfp); netpage->index, cachefiles_gfp);
if (ret == 0) if (ret == 0)
goto installed_new_backing_page; goto installed_new_backing_page;
if (ret != -EEXIST) if (ret != -EEXIST)
goto nomem_page; goto nomem_page;
} }
/* we've installed a new backing page, so now we need to add it /* we've installed a new backing page, so now we need to start
* to the LRU list and start it reading */ * it reading */
installed_new_backing_page: installed_new_backing_page:
_debug("- new %p", newpage); _debug("- new %p", newpage);
backpage = newpage; backpage = newpage;
newpage = NULL; newpage = NULL;
lru_cache_add_file(backpage);
read_backing_page: read_backing_page:
ret = bmapping->a_ops->readpage(NULL, backpage); ret = bmapping->a_ops->readpage(NULL, backpage);
if (ret < 0) if (ret < 0)
@ -510,24 +508,23 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
goto nomem; goto nomem;
} }
ret = add_to_page_cache(newpage, bmapping, ret = add_to_page_cache_lru(newpage, bmapping,
netpage->index, cachefiles_gfp); netpage->index,
cachefiles_gfp);
if (ret == 0) if (ret == 0)
goto installed_new_backing_page; goto installed_new_backing_page;
if (ret != -EEXIST) if (ret != -EEXIST)
goto nomem; goto nomem;
} }
/* we've installed a new backing page, so now we need to add it /* we've installed a new backing page, so now we need
* to the LRU list and start it reading */ * to start it reading */
installed_new_backing_page: installed_new_backing_page:
_debug("- new %p", newpage); _debug("- new %p", newpage);
backpage = newpage; backpage = newpage;
newpage = NULL; newpage = NULL;
lru_cache_add_file(backpage);
reread_backing_page: reread_backing_page:
ret = bmapping->a_ops->readpage(NULL, backpage); ret = bmapping->a_ops->readpage(NULL, backpage);
if (ret < 0) if (ret < 0)
@ -538,8 +535,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
monitor_backing_page: monitor_backing_page:
_debug("- monitor add"); _debug("- monitor add");
ret = add_to_page_cache(netpage, op->mapping, netpage->index, ret = add_to_page_cache_lru(netpage, op->mapping,
cachefiles_gfp); netpage->index, cachefiles_gfp);
if (ret < 0) { if (ret < 0) {
if (ret == -EEXIST) { if (ret == -EEXIST) {
page_cache_release(netpage); page_cache_release(netpage);
@ -549,8 +546,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
goto nomem; goto nomem;
} }
lru_cache_add_file(netpage);
/* install a monitor */ /* install a monitor */
page_cache_get(netpage); page_cache_get(netpage);
monitor->netfs_page = netpage; monitor->netfs_page = netpage;
@ -613,8 +608,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
backing_page_already_uptodate: backing_page_already_uptodate:
_debug("- uptodate"); _debug("- uptodate");
ret = add_to_page_cache(netpage, op->mapping, netpage->index, ret = add_to_page_cache_lru(netpage, op->mapping,
cachefiles_gfp); netpage->index, cachefiles_gfp);
if (ret < 0) { if (ret < 0) {
if (ret == -EEXIST) { if (ret == -EEXIST) {
page_cache_release(netpage); page_cache_release(netpage);
@ -631,8 +626,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
fscache_mark_page_cached(op, netpage); fscache_mark_page_cached(op, netpage);
lru_cache_add_file(netpage);
/* the netpage is unlocked and marked up to date here */ /* the netpage is unlocked and marked up to date here */
fscache_end_io(op, netpage, 0); fscache_end_io(op, netpage, 0);
page_cache_release(netpage); page_cache_release(netpage);