Skip to content

Commit 55881bc

Browse files
hnaztorvalds
authored andcommitted
fs: cachefiles: use add_to_page_cache_lru()
This code used to have its own lru cache pagevec up until a0b8cab ("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 <[email protected]> Reviewed-by: Rik van Riel <[email protected]> Reviewed-by: Minchan Kim <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Bob Liu <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dave Chinner <[email protected]> Cc: Greg Thelen <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Jan Kara <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: Luigi Semenzato <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Metin Doslu <[email protected]> Cc: Michel Lespinasse <[email protected]> Cc: Ozgun Erdogan <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: Ryan Mallon <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: David Howells <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6a3ed21 commit 55881bc

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

fs/cachefiles/rdwr.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -265,24 +265,22 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
265265
goto nomem_monitor;
266266
}
267267

268-
ret = add_to_page_cache(newpage, bmapping,
269-
netpage->index, cachefiles_gfp);
268+
ret = add_to_page_cache_lru(newpage, bmapping,
269+
netpage->index, cachefiles_gfp);
270270
if (ret == 0)
271271
goto installed_new_backing_page;
272272
if (ret != -EEXIST)
273273
goto nomem_page;
274274
}
275275

276-
/* we've installed a new backing page, so now we need to add it
277-
* to the LRU list and start it reading */
276+
/* we've installed a new backing page, so now we need to start
277+
* it reading */
278278
installed_new_backing_page:
279279
_debug("- new %p", newpage);
280280

281281
backpage = newpage;
282282
newpage = NULL;
283283

284-
lru_cache_add_file(backpage);
285-
286284
read_backing_page:
287285
ret = bmapping->a_ops->readpage(NULL, backpage);
288286
if (ret < 0)
@@ -510,24 +508,23 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
510508
goto nomem;
511509
}
512510

513-
ret = add_to_page_cache(newpage, bmapping,
514-
netpage->index, cachefiles_gfp);
511+
ret = add_to_page_cache_lru(newpage, bmapping,
512+
netpage->index,
513+
cachefiles_gfp);
515514
if (ret == 0)
516515
goto installed_new_backing_page;
517516
if (ret != -EEXIST)
518517
goto nomem;
519518
}
520519

521-
/* we've installed a new backing page, so now we need to add it
522-
* to the LRU list and start it reading */
520+
/* we've installed a new backing page, so now we need
521+
* to start it reading */
523522
installed_new_backing_page:
524523
_debug("- new %p", newpage);
525524

526525
backpage = newpage;
527526
newpage = NULL;
528527

529-
lru_cache_add_file(backpage);
530-
531528
reread_backing_page:
532529
ret = bmapping->a_ops->readpage(NULL, backpage);
533530
if (ret < 0)
@@ -538,8 +535,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
538535
monitor_backing_page:
539536
_debug("- monitor add");
540537

541-
ret = add_to_page_cache(netpage, op->mapping, netpage->index,
542-
cachefiles_gfp);
538+
ret = add_to_page_cache_lru(netpage, op->mapping,
539+
netpage->index, cachefiles_gfp);
543540
if (ret < 0) {
544541
if (ret == -EEXIST) {
545542
page_cache_release(netpage);
@@ -549,8 +546,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
549546
goto nomem;
550547
}
551548

552-
lru_cache_add_file(netpage);
553-
554549
/* install a monitor */
555550
page_cache_get(netpage);
556551
monitor->netfs_page = netpage;
@@ -613,8 +608,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
613608
backing_page_already_uptodate:
614609
_debug("- uptodate");
615610

616-
ret = add_to_page_cache(netpage, op->mapping, netpage->index,
617-
cachefiles_gfp);
611+
ret = add_to_page_cache_lru(netpage, op->mapping,
612+
netpage->index, cachefiles_gfp);
618613
if (ret < 0) {
619614
if (ret == -EEXIST) {
620615
page_cache_release(netpage);
@@ -631,8 +626,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
631626

632627
fscache_mark_page_cached(op, netpage);
633628

634-
lru_cache_add_file(netpage);
635-
636629
/* the netpage is unlocked and marked up to date here */
637630
fscache_end_io(op, netpage, 0);
638631
page_cache_release(netpage);

0 commit comments

Comments
 (0)