From: Christoph Hellwig <hch@lst.de> To: Andrew Morton <akpm@linux-foundation.org> Cc: Sami Tolvanen <samitolvanen@google.com>, Kees Cook <keescook@chromium.org>, Nick Desaulniers <ndesaulniers@google.com>, linux-mtd@lists.infradead.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] mm: don't cast ->readpage to filler_t for do_read_cache_page Date: Wed, 1 May 2019 12:06:34 -0400 [thread overview] Message-ID: <20190501160636.30841-3-hch@lst.de> (raw) In-Reply-To: <20190501160636.30841-1-hch@lst.de> We can just pass a NULL filler and do the right thing inside of do_read_cache_page based on the NULL parameter. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/linux/pagemap.h | 3 +-- mm/filemap.c | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index bcf909d0de5f..f52c3a2074cd 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -386,8 +386,7 @@ extern int read_cache_pages(struct address_space *mapping, static inline struct page *read_mapping_page(struct address_space *mapping, pgoff_t index, void *data) { - filler_t *filler = (filler_t *)mapping->a_ops->readpage; - return read_cache_page(mapping, index, filler, data); + return read_cache_page(mapping, index, NULL, data); } /* diff --git a/mm/filemap.c b/mm/filemap.c index a2fc59f56f50..51f5b02c299a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2866,7 +2866,11 @@ static struct page *do_read_cache_page(struct address_space *mapping, } filler: - err = filler(data, page); + if (filler) + err = filler(data, page); + else + err = mapping->a_ops->readpage(data, page); + if (err < 0) { put_page(page); return ERR_PTR(err); @@ -2978,9 +2982,7 @@ struct page *read_cache_page_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp) { - filler_t *filler = (filler_t *)mapping->a_ops->readpage; - - return do_read_cache_page(mapping, index, filler, NULL, gfp); + return do_read_cache_page(mapping, index, NULL, NULL, gfp); } EXPORT_SYMBOL(read_cache_page_gfp); -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-nfs@vger.kernel.org, Kees Cook <keescook@chromium.org>, Nick Desaulniers <ndesaulniers@google.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, Sami Tolvanen <samitolvanen@google.com> Subject: [PATCH 2/4] mm: don't cast ->readpage to filler_t for do_read_cache_page Date: Wed, 1 May 2019 12:06:34 -0400 [thread overview] Message-ID: <20190501160636.30841-3-hch@lst.de> (raw) In-Reply-To: <20190501160636.30841-1-hch@lst.de> We can just pass a NULL filler and do the right thing inside of do_read_cache_page based on the NULL parameter. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/linux/pagemap.h | 3 +-- mm/filemap.c | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index bcf909d0de5f..f52c3a2074cd 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -386,8 +386,7 @@ extern int read_cache_pages(struct address_space *mapping, static inline struct page *read_mapping_page(struct address_space *mapping, pgoff_t index, void *data) { - filler_t *filler = (filler_t *)mapping->a_ops->readpage; - return read_cache_page(mapping, index, filler, data); + return read_cache_page(mapping, index, NULL, data); } /* diff --git a/mm/filemap.c b/mm/filemap.c index a2fc59f56f50..51f5b02c299a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2866,7 +2866,11 @@ static struct page *do_read_cache_page(struct address_space *mapping, } filler: - err = filler(data, page); + if (filler) + err = filler(data, page); + else + err = mapping->a_ops->readpage(data, page); + if (err < 0) { put_page(page); return ERR_PTR(err); @@ -2978,9 +2982,7 @@ struct page *read_cache_page_gfp(struct address_space *mapping, pgoff_t index, gfp_t gfp) { - filler_t *filler = (filler_t *)mapping->a_ops->readpage; - - return do_read_cache_page(mapping, index, filler, NULL, gfp); + return do_read_cache_page(mapping, index, NULL, NULL, gfp); } EXPORT_SYMBOL(read_cache_page_gfp); -- 2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2019-05-01 16:07 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-01 16:06 fix filler_t callback type mismatches Christoph Hellwig 2019-05-01 16:06 ` Christoph Hellwig 2019-05-01 16:06 ` [PATCH 1/4] mm: fix an overly long line in read_cache_page Christoph Hellwig 2019-05-01 16:06 ` Christoph Hellwig 2019-05-01 16:06 ` Christoph Hellwig [this message] 2019-05-01 16:06 ` [PATCH 2/4] mm: don't cast ->readpage to filler_t for do_read_cache_page Christoph Hellwig 2019-05-01 16:06 ` [PATCH 3/4] nfs: pass the correct prototype to read_cache_page Christoph Hellwig 2019-05-01 16:06 ` Christoph Hellwig 2019-05-01 16:06 ` [PATCH 4/4] jffs2: " Christoph Hellwig 2019-05-01 16:06 ` Christoph Hellwig 2019-05-01 17:00 ` fix filler_t callback type mismatches Sami Tolvanen 2019-05-01 17:00 ` Sami Tolvanen 2019-05-01 17:00 ` Sami Tolvanen 2019-05-01 17:34 ` [PATCH 5/4] 9p: pass the correct prototype to read_cache_page Christoph Hellwig 2019-05-01 17:34 ` Christoph Hellwig 2019-05-02 6:08 ` William Kucharski 2019-05-02 6:08 ` William Kucharski 2019-05-02 10:20 ` Matthew Wilcox 2019-05-02 10:20 ` Matthew Wilcox 2019-05-02 13:04 ` Christoph Hellwig 2019-05-02 13:04 ` Christoph Hellwig 2019-05-02 14:01 ` William Kucharski 2019-05-02 14:01 ` William Kucharski 2019-05-01 18:25 ` fix filler_t callback type mismatches Kees Cook 2019-05-01 18:25 ` Kees Cook 2019-05-01 18:25 ` Kees Cook 2019-05-20 5:57 fix filler_t callback type mismatches v2 Christoph Hellwig 2019-05-20 5:57 ` [PATCH 2/4] mm: don't cast ->readpage to filler_t for do_read_cache_page Christoph Hellwig 2019-05-20 5:57 ` Christoph Hellwig
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190501160636.30841-3-hch@lst.de \ --to=hch@lst.de \ --cc=akpm@linux-foundation.org \ --cc=keescook@chromium.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linux-mtd@lists.infradead.org \ --cc=linux-nfs@vger.kernel.org \ --cc=ndesaulniers@google.com \ --cc=samitolvanen@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.