Re: [Cluster-devel] [PATCH v6 14/19] ext4: Convert from readpages to readahead

2020-02-19 Thread Eric Biggers
On Mon, Feb 17, 2020 at 10:46:05AM -0800, Matthew Wilcox wrote:
> diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
> index c1769afbf799..e14841ade612 100644
> --- a/fs/ext4/readpage.c
> +++ b/fs/ext4/readpage.c
> @@ -7,8 +7,8 @@
>   *
>   * This was originally taken from fs/mpage.c
>   *
> - * The intent is the ext4_mpage_readpages() function here is intended
> - * to replace mpage_readpages() in the general case, not just for
> + * The ext4_mpage_readahead() function here is intended to
> + * replace mpage_readahead() in the general case, not just for
>   * encrypted files.  It has some limitations (see below), where it
>   * will fall back to read_block_full_page(), but these limitations
>   * should only be hit when page_size != block_size.
> @@ -222,8 +222,7 @@ static inline loff_t ext4_readpage_limit(struct inode 
> *inode)
>  }

This says ext4_mpage_readahead(), but it's actually still called
ext4_mpage_readpages().

- Eric




Re: [Cluster-devel] [PATCH v6 14/19] ext4: Convert from readpages to readahead

2020-02-18 Thread Dave Chinner
On Mon, Feb 17, 2020 at 10:46:05AM -0800, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" 
> 
> Use the new readahead operation in ext4
> 
> Signed-off-by: Matthew Wilcox (Oracle) 

There's nothing I can see in this that would cause that list
corruption I saw with ext4.

I'll re-introduce the patch and see if it falls over again.

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com




[Cluster-devel] [PATCH v6 14/19] ext4: Convert from readpages to readahead

2020-02-17 Thread Matthew Wilcox
From: "Matthew Wilcox (Oracle)" 

Use the new readahead operation in ext4

Signed-off-by: Matthew Wilcox (Oracle) 
---
 fs/ext4/ext4.h |  3 +--
 fs/ext4/inode.c| 23 ++-
 fs/ext4/readpage.c | 22 --
 3 files changed, 19 insertions(+), 29 deletions(-)

diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 4441331d06cc..1570a0b51b73 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -3279,8 +3279,7 @@ static inline void ext4_set_de_type(struct super_block 
*sb,
 
 /* readpages.c */
 extern int ext4_mpage_readpages(struct address_space *mapping,
-   struct list_head *pages, struct page *page,
-   unsigned nr_pages, bool is_readahead);
+   struct readahead_control *rac, struct page *page);
 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 e60aca791d3f..b3349bfb75b8 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3218,7 +3218,7 @@ static sector_t ext4_bmap(struct address_space *mapping, 
sector_t block)
 static int ext4_readpage(struct file *file, struct page *page)
 {
int ret = -EAGAIN;
-   struct inode *inode = page->mapping->host;
+   struct inode *inode = file_inode(file);
 
trace_ext4_readpage(page);
 
@@ -3226,23 +3226,20 @@ static int ext4_readpage(struct file *file, struct page 
*page)
ret = ext4_readpage_inline(inode, page);
 
if (ret == -EAGAIN)
-   return ext4_mpage_readpages(page->mapping, NULL, page, 1,
-   false);
+   return ext4_mpage_readpages(page->mapping, NULL, page);
 
return ret;
 }
 
-static int
-ext4_readpages(struct file *file, struct address_space *mapping,
-   struct list_head *pages, unsigned nr_pages)
+static void ext4_readahead(struct readahead_control *rac)
 {
-   struct inode *inode = mapping->host;
+   struct inode *inode = rac->mapping->host;
 
-   /* If the file has inline data, no need to do readpages. */
+   /* If the file has inline data, no need to do readahead. */
if (ext4_has_inline_data(inode))
-   return 0;
+   return;
 
-   return ext4_mpage_readpages(mapping, pages, NULL, nr_pages, true);
+   ext4_mpage_readpages(rac->mapping, rac, NULL);
 }
 
 static void ext4_invalidatepage(struct page *page, unsigned int offset,
@@ -3587,7 +3584,7 @@ static int ext4_set_page_dirty(struct page *page)
 
 static const struct address_space_operations ext4_aops = {
.readpage   = ext4_readpage,
-   .readpages  = ext4_readpages,
+   .readahead  = ext4_readahead,
.writepage  = ext4_writepage,
.writepages = ext4_writepages,
.write_begin= ext4_write_begin,
@@ -3604,7 +3601,7 @@ static const struct address_space_operations ext4_aops = {
 
 static const struct address_space_operations ext4_journalled_aops = {
.readpage   = ext4_readpage,
-   .readpages  = ext4_readpages,
+   .readahead  = ext4_readahead,
.writepage  = ext4_writepage,
.writepages = ext4_writepages,
.write_begin= ext4_write_begin,
@@ -3620,7 +3617,7 @@ static const struct address_space_operations 
ext4_journalled_aops = {
 
 static const struct address_space_operations ext4_da_aops = {
.readpage   = ext4_readpage,
-   .readpages  = ext4_readpages,
+   .readahead  = ext4_readahead,
.writepage  = ext4_writepage,
.writepages = ext4_writepages,
.write_begin= ext4_da_write_begin,
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index c1769afbf799..e14841ade612 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -7,8 +7,8 @@
  *
  * This was originally taken from fs/mpage.c
  *
- * The intent is the ext4_mpage_readpages() function here is intended
- * to replace mpage_readpages() in the general case, not just for
+ * The ext4_mpage_readahead() function here is intended to
+ * replace mpage_readahead() in the general case, not just for
  * encrypted files.  It has some limitations (see below), where it
  * will fall back to read_block_full_page(), but these limitations
  * should only be hit when page_size != block_size.
@@ -222,8 +222,7 @@ static inline loff_t ext4_readpage_limit(struct inode 
*inode)
 }
 
 int ext4_mpage_readpages(struct address_space *mapping,
-struct list_head *pages, struct page *page,
-unsigned nr_pages, bool is_readahead)
+   struct readahead_control *rac, struct page *page)
 {
struct bio *bio = NULL;
sector_t last_block_in_bio = 0;
@@ -241,6 +240,7 @@ int