[PATCH 02/14] fs: define filler_t as a function pointer type

From: jglisse
Date: Tue Oct 06 2020 - 21:07:32 EST


From: Jérôme Glisse <jglisse@xxxxxxxxxx>

Coccinelle is confuse by filler_t not being a regular function pointer
type. As they are no reason to define filler_t as a non pointer type
redefine it as a function pointer type and update function prototype
accordingly.

Signed-off-by: Jérôme Glisse <jglisse@xxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: Josef Bacik <jbacik@xxxxxx>
---
fs/nfs/dir.c | 2 +-
fs/nfs/symlink.c | 4 ++--
include/linux/pagemap.h | 6 +++---
mm/filemap.c | 5 ++---
mm/readahead.c | 2 +-
5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index cb52db9a0cfb7..da1fe71ae810d 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -740,7 +740,7 @@ static
struct page *get_cache_page(nfs_readdir_descriptor_t *desc)
{
return read_cache_page(desc->file->f_mapping, desc->page_index,
- nfs_readdir_filler, desc);
+ (filler_t)nfs_readdir_filler, desc);
}

/*
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 25ba299fdac2e..76691d94ae5f8 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -66,8 +66,8 @@ static const char *nfs_get_link(struct dentry *dentry,
err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping));
if (err)
return err;
- page = read_cache_page(&inode->i_data, 0, nfs_symlink_filler,
- inode);
+ page = read_cache_page(&inode->i_data, 0,
+ (filler_t)nfs_symlink_filler, inode);
if (IS_ERR(page))
return ERR_CAST(page);
}
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 7de11dcd534d6..9acfc605b3bc3 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -264,7 +264,7 @@ static inline gfp_t readahead_gfp_mask(struct address_space *x)
return mapping_gfp_mask(x) | __GFP_NORETRY | __GFP_NOWARN;
}

-typedef int filler_t(void *, struct page *);
+typedef int (*filler_t)(void *, struct page *);

pgoff_t page_cache_next_miss(struct address_space *mapping,
pgoff_t index, unsigned long max_scan);
@@ -425,11 +425,11 @@ static inline struct page *grab_cache_page(struct address_space *mapping,
}

extern struct page * read_cache_page(struct address_space *mapping,
- pgoff_t index, filler_t *filler, void *data);
+ pgoff_t index, filler_t filler, void *data);
extern struct page * read_cache_page_gfp(struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask);
extern int read_cache_pages(struct address_space *mapping,
- struct list_head *pages, filler_t *filler, void *data);
+ struct list_head *pages, filler_t filler, void *data);

static inline struct page *read_mapping_page(struct address_space *mapping,
pgoff_t index, void *data)
diff --git a/mm/filemap.c b/mm/filemap.c
index 99c49eeae71b8..2cdbbffc55522 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2942,8 +2942,7 @@ static struct page *wait_on_page_read(struct page *page)
}

static struct page *do_read_cache_page(struct address_space *mapping,
- pgoff_t index,
- int (*filler)(void *, struct page *),
+ pgoff_t index, filler_t filler,
void *data,
gfp_t gfp)
{
@@ -3064,7 +3063,7 @@ static struct page *do_read_cache_page(struct address_space *mapping,
*/
struct page *read_cache_page(struct address_space *mapping,
pgoff_t index,
- int (*filler)(void *, struct page *),
+ filler_t filler,
void *data)
{
return do_read_cache_page(mapping, index, filler, data,
diff --git a/mm/readahead.c b/mm/readahead.c
index 3c9a8dd7c56c8..cd67c9cfa931a 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -87,7 +87,7 @@ static void read_cache_pages_invalidate_pages(struct address_space *mapping,
* Returns: %0 on success, error return by @filler otherwise
*/
int read_cache_pages(struct address_space *mapping, struct list_head *pages,
- int (*filler)(void *, struct page *), void *data)
+ filler_t filler, void *data)
{
struct page *page;
int ret = 0;
--
2.26.2