summaryrefslogtreecommitdiff
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-05-08 15:07:11 -0400
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-05-09 16:36:52 -0400
commit07950008692bf22074020e927e95655cd48fdcda (patch)
treeba1af1115941d1cfea1e45e2dc5c06e953775cba /mm/filemap.c
parente9b5b23e957ef9260fec811d8d8081125889308a (diff)
downloadlinux-starfive-07950008692bf22074020e927e95655cd48fdcda.tar.gz
linux-starfive-07950008692bf22074020e927e95655cd48fdcda.tar.bz2
linux-starfive-07950008692bf22074020e927e95655cd48fdcda.zip
mm/filemap: Hoist filler_t decision to the top of do_read_cache_folio()
Now that filler_t and aops->read_folio() have the same type, we can decide which one to use at the top of the function, and cache ->read_folio in the filler parameter. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 81a0ed08a82c..9b7fa47feb5e 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3487,6 +3487,9 @@ static struct folio *do_read_cache_folio(struct address_space *mapping,
{
struct folio *folio;
int err;
+
+ if (!filler)
+ filler = mapping->a_ops->read_folio;
repeat:
folio = filemap_get_folio(mapping, index);
if (!folio) {
@@ -3503,11 +3506,7 @@ repeat:
}
filler:
- if (filler)
- err = filler(file, folio);
- else
- err = mapping->a_ops->read_folio(file, folio);
-
+ err = filler(file, folio);
if (err < 0) {
folio_put(folio);
return ERR_PTR(err);