mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 01:09:38 -05:00
readahead: Convert page_cache_ra_unbounded to folios
This saves 99 bytes of kernel text. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
This commit is contained in:
parent
7836d99900
commit
0387df1d1f
1 changed files with 9 additions and 9 deletions
|
@ -196,9 +196,9 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
|
||||||
* Preallocate as many pages as we will need.
|
* Preallocate as many pages as we will need.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < nr_to_read; i++) {
|
for (i = 0; i < nr_to_read; i++) {
|
||||||
struct page *page = xa_load(&mapping->i_pages, index + i);
|
struct folio *folio = xa_load(&mapping->i_pages, index + i);
|
||||||
|
|
||||||
if (page && !xa_is_value(page)) {
|
if (folio && !xa_is_value(folio)) {
|
||||||
/*
|
/*
|
||||||
* Page already present? Kick off the current batch
|
* Page already present? Kick off the current batch
|
||||||
* of contiguous pages before continuing with the
|
* of contiguous pages before continuing with the
|
||||||
|
@ -212,21 +212,21 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
page = __page_cache_alloc(gfp_mask);
|
folio = filemap_alloc_folio(gfp_mask, 0);
|
||||||
if (!page)
|
if (!folio)
|
||||||
break;
|
break;
|
||||||
if (mapping->a_ops->readpages) {
|
if (mapping->a_ops->readpages) {
|
||||||
page->index = index + i;
|
folio->index = index + i;
|
||||||
list_add(&page->lru, &page_pool);
|
list_add(&folio->lru, &page_pool);
|
||||||
} else if (add_to_page_cache_lru(page, mapping, index + i,
|
} else if (filemap_add_folio(mapping, folio, index + i,
|
||||||
gfp_mask) < 0) {
|
gfp_mask) < 0) {
|
||||||
put_page(page);
|
folio_put(folio);
|
||||||
read_pages(ractl, &page_pool, true);
|
read_pages(ractl, &page_pool, true);
|
||||||
i = ractl->_index + ractl->_nr_pages - index - 1;
|
i = ractl->_index + ractl->_nr_pages - index - 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (i == nr_to_read - lookahead_size)
|
if (i == nr_to_read - lookahead_size)
|
||||||
SetPageReadahead(page);
|
folio_set_readahead(folio);
|
||||||
ractl->_nr_pages++;
|
ractl->_nr_pages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue