Keep all the read into pagecache code in a single file.

Signed-off-by: Christoph Hellwig <[email protected]>
---
 fs/ext4/ext4.h     |  4 ++--
 fs/ext4/inode.c    | 27 ---------------------------
 fs/ext4/readpage.c | 31 ++++++++++++++++++++++++++++++-
 3 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 56112f201cac..a8a448e20ef8 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -3735,8 +3735,8 @@ static inline void ext4_set_de_type(struct super_block 
*sb,
 }
 
 /* readpages.c */
-extern int ext4_mpage_readpages(struct inode *inode,
-               struct readahead_control *rac, struct folio *folio);
+int ext4_read_folio(struct file *file, struct folio *folio);
+void ext4_readahead(struct readahead_control *rac);
 extern int __init ext4_init_post_read_processing(void);
 extern void ext4_exit_post_read_processing(void);
 
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8c2ef98fa530..e98954e7d0b3 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3380,33 +3380,6 @@ static sector_t ext4_bmap(struct address_space *mapping, 
sector_t block)
        return ret;
 }
 
-static int ext4_read_folio(struct file *file, struct folio *folio)
-{
-       int ret = -EAGAIN;
-       struct inode *inode = folio->mapping->host;
-
-       trace_ext4_read_folio(inode, folio);
-
-       if (ext4_has_inline_data(inode))
-               ret = ext4_readpage_inline(inode, folio);
-
-       if (ret == -EAGAIN)
-               return ext4_mpage_readpages(inode, NULL, folio);
-
-       return ret;
-}
-
-static void ext4_readahead(struct readahead_control *rac)
-{
-       struct inode *inode = rac->mapping->host;
-
-       /* If the file has inline data, no need to do readahead. */
-       if (ext4_has_inline_data(inode))
-               return;
-
-       ext4_mpage_readpages(inode, rac, NULL);
-}
-
 static void ext4_invalidate_folio(struct folio *folio, size_t offset,
                                size_t length)
 {
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index 267594ef0b2c..bf84952ebf94 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -45,6 +45,7 @@
 #include <linux/pagevec.h>
 
 #include "ext4.h"
+#include <trace/events/ext4.h>
 
 #define NUM_PREALLOC_POST_READ_CTXS    128
 
@@ -209,7 +210,7 @@ static inline loff_t ext4_readpage_limit(struct inode 
*inode)
        return i_size_read(inode);
 }
 
-int ext4_mpage_readpages(struct inode *inode,
+static int ext4_mpage_readpages(struct inode *inode,
                struct readahead_control *rac, struct folio *folio)
 {
        struct bio *bio = NULL;
@@ -394,6 +395,34 @@ int ext4_mpage_readpages(struct inode *inode,
        return 0;
 }
 
+int ext4_read_folio(struct file *file, struct folio *folio)
+{
+       int ret = -EAGAIN;
+       struct inode *inode = folio->mapping->host;
+
+       trace_ext4_read_folio(inode, folio);
+
+       if (ext4_has_inline_data(inode))
+               ret = ext4_readpage_inline(inode, folio);
+
+       if (ret == -EAGAIN)
+               return ext4_mpage_readpages(inode, NULL, folio);
+
+       return ret;
+}
+
+void ext4_readahead(struct readahead_control *rac)
+{
+       struct inode *inode = rac->mapping->host;
+
+       /* If the file has inline data, no need to do readahead. */
+       if (ext4_has_inline_data(inode))
+               return;
+
+       ext4_mpage_readpages(inode, rac, NULL);
+}
+
+
 int __init ext4_init_post_read_processing(void)
 {
        bio_post_read_ctx_cache = KMEM_CACHE(bio_post_read_ctx, 
SLAB_RECLAIM_ACCOUNT);
-- 
2.47.3



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to