erofs: Don't use certain unnecessary folio_*() functions
authorDavid Howells <dhowells@redhat.com>
Mon, 15 Jan 2024 14:46:35 +0000 (22:46 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 15 Jan 2024 15:52:52 +0000 (23:52 +0800)
Filesystems should use folio->index and folio->mapping, instead of
folio_index(folio), folio_mapping() and folio_file_mapping() since
they know that it's in the pagecache.

Change this automagically with:

perl -p -i -e 's/folio_mapping[(]([^)]*)[)]/\1->mapping/g' fs/erofs/*.c
perl -p -i -e 's/folio_file_mapping[(]([^)]*)[)]/\1->mapping/g' fs/erofs/*.c
perl -p -i -e 's/folio_index[(]([^)]*)[)]/\1->index/g' fs/erofs/*.c

Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Cc: Chao Yu <chao@kernel.org>
Cc: Yue Hu <huyue2@coolpad.com>
Cc: Jeffle Xu <jefflexu@linux.alibaba.com>
Cc: linux-erofs@lists.ozlabs.org
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240115144635.1931422-1-hsiangkao@linux.alibaba.com
fs/erofs/fscache.c

index 87ff35bff8d5bb3acb8dbc4d79c07d1d018cba56..bc12030393b24f26231fb363ac07e3150cd6babb 100644 (file)
@@ -165,10 +165,10 @@ static int erofs_fscache_read_folios_async(struct fscache_cookie *cookie,
 static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
 {
        int ret;
-       struct erofs_fscache *ctx = folio_mapping(folio)->host->i_private;
+       struct erofs_fscache *ctx = folio->mapping->host->i_private;
        struct erofs_fscache_request *req;
 
-       req = erofs_fscache_req_alloc(folio_mapping(folio),
+       req = erofs_fscache_req_alloc(folio->mapping,
                                folio_pos(folio), folio_size(folio));
        if (IS_ERR(req)) {
                folio_unlock(folio);
@@ -276,7 +276,7 @@ static int erofs_fscache_read_folio(struct file *file, struct folio *folio)
        struct erofs_fscache_request *req;
        int ret;
 
-       req = erofs_fscache_req_alloc(folio_mapping(folio),
+       req = erofs_fscache_req_alloc(folio->mapping,
                        folio_pos(folio), folio_size(folio));
        if (IS_ERR(req)) {
                folio_unlock(folio);