All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	ocfs2-devel@oss.oracle.com, linux-xfs@vger.kernel.org,
	Dave Chinner <dchinner@redhat.com>,
	William Kucharski <william.kucharski@oracle.com>
Subject: [PATCH v10 24/25] fuse: Convert from readpages to readahead
Date: Mon, 23 Mar 2020 13:22:58 -0700	[thread overview]
Message-ID: <20200323202259.13363-25-willy@infradead.org> (raw)
In-Reply-To: <20200323202259.13363-1-willy@infradead.org>

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Use the new readahead operation in fuse.  Switching away from the
read_cache_pages() helper gets rid of an implicit call to put_page(),
so we can get rid of the get_page() call in fuse_readpages_fill().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
---
 fs/fuse/file.c | 46 +++++++++++++++++++---------------------------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9d67b830fb7a..5749505bcff6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -923,9 +923,8 @@ struct fuse_fill_data {
 	unsigned int max_pages;
 };
 
-static int fuse_readpages_fill(void *_data, struct page *page)
+static int fuse_readpages_fill(struct fuse_fill_data *data, struct page *page)
 {
-	struct fuse_fill_data *data = _data;
 	struct fuse_io_args *ia = data->ia;
 	struct fuse_args_pages *ap = &ia->ap;
 	struct inode *inode = data->inode;
@@ -941,10 +940,8 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 					fc->max_pages);
 		fuse_send_readpages(ia, data->file);
 		data->ia = ia = fuse_io_alloc(NULL, data->max_pages);
-		if (!ia) {
-			unlock_page(page);
+		if (!ia)
 			return -ENOMEM;
-		}
 		ap = &ia->ap;
 	}
 
@@ -954,7 +951,6 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 		return -EIO;
 	}
 
-	get_page(page);
 	ap->pages[ap->num_pages] = page;
 	ap->descs[ap->num_pages].length = PAGE_SIZE;
 	ap->num_pages++;
@@ -962,37 +958,33 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 	return 0;
 }
 
-static int fuse_readpages(struct file *file, struct address_space *mapping,
-			  struct list_head *pages, unsigned nr_pages)
+static void fuse_readahead(struct readahead_control *rac)
 {
-	struct inode *inode = mapping->host;
+	struct inode *inode = rac->mapping->host;
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_fill_data data;
-	int err;
+	struct page *page;
 
-	err = -EIO;
 	if (is_bad_inode(inode))
-		goto out;
+		return;
 
-	data.file = file;
+	data.file = rac->file;
 	data.inode = inode;
-	data.nr_pages = nr_pages;
-	data.max_pages = min_t(unsigned int, nr_pages, fc->max_pages);
-;
+	data.nr_pages = readahead_count(rac);
+	data.max_pages = min_t(unsigned int, data.nr_pages, fc->max_pages);
 	data.ia = fuse_io_alloc(NULL, data.max_pages);
-	err = -ENOMEM;
 	if (!data.ia)
-		goto out;
+		return;
 
-	err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
-	if (!err) {
-		if (data.ia->ap.num_pages)
-			fuse_send_readpages(data.ia, file);
-		else
-			fuse_io_free(data.ia);
+	while ((page = readahead_page(rac))) {
+		if (fuse_readpages_fill(&data, page) != 0)
+			return;
 	}
-out:
-	return err;
+
+	if (data.ia->ap.num_pages)
+		fuse_send_readpages(data.ia, rac->file);
+	else
+		fuse_io_free(data.ia);
 }
 
 static ssize_t fuse_cache_read_iter(struct kiocb *iocb, struct iov_iter *to)
@@ -3373,10 +3365,10 @@ static const struct file_operations fuse_file_operations = {
 
 static const struct address_space_operations fuse_file_aops  = {
 	.readpage	= fuse_readpage,
+	.readahead	= fuse_readahead,
 	.writepage	= fuse_writepage,
 	.writepages	= fuse_writepages,
 	.launder_page	= fuse_launder_page,
-	.readpages	= fuse_readpages,
 	.set_page_dirty	= __set_page_dirty_nobuffers,
 	.bmap		= fuse_bmap,
 	.direct_IO	= fuse_direct_IO,
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <willy@infradead.org>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH v10 24/25] fuse: Convert from readpages to readahead
Date: Mon, 23 Mar 2020 13:22:58 -0700	[thread overview]
Message-ID: <20200323202259.13363-25-willy@infradead.org> (raw)
In-Reply-To: <20200323202259.13363-1-willy@infradead.org>

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Use the new readahead operation in fuse.  Switching away from the
read_cache_pages() helper gets rid of an implicit call to put_page(),
so we can get rid of the get_page() call in fuse_readpages_fill().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
---
 fs/fuse/file.c | 46 +++++++++++++++++++---------------------------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9d67b830fb7a..5749505bcff6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -923,9 +923,8 @@ struct fuse_fill_data {
 	unsigned int max_pages;
 };
 
-static int fuse_readpages_fill(void *_data, struct page *page)
+static int fuse_readpages_fill(struct fuse_fill_data *data, struct page *page)
 {
-	struct fuse_fill_data *data = _data;
 	struct fuse_io_args *ia = data->ia;
 	struct fuse_args_pages *ap = &ia->ap;
 	struct inode *inode = data->inode;
@@ -941,10 +940,8 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 					fc->max_pages);
 		fuse_send_readpages(ia, data->file);
 		data->ia = ia = fuse_io_alloc(NULL, data->max_pages);
-		if (!ia) {
-			unlock_page(page);
+		if (!ia)
 			return -ENOMEM;
-		}
 		ap = &ia->ap;
 	}
 
@@ -954,7 +951,6 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 		return -EIO;
 	}
 
-	get_page(page);
 	ap->pages[ap->num_pages] = page;
 	ap->descs[ap->num_pages].length = PAGE_SIZE;
 	ap->num_pages++;
@@ -962,37 +958,33 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 	return 0;
 }
 
-static int fuse_readpages(struct file *file, struct address_space *mapping,
-			  struct list_head *pages, unsigned nr_pages)
+static void fuse_readahead(struct readahead_control *rac)
 {
-	struct inode *inode = mapping->host;
+	struct inode *inode = rac->mapping->host;
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_fill_data data;
-	int err;
+	struct page *page;
 
-	err = -EIO;
 	if (is_bad_inode(inode))
-		goto out;
+		return;
 
-	data.file = file;
+	data.file = rac->file;
 	data.inode = inode;
-	data.nr_pages = nr_pages;
-	data.max_pages = min_t(unsigned int, nr_pages, fc->max_pages);
-;
+	data.nr_pages = readahead_count(rac);
+	data.max_pages = min_t(unsigned int, data.nr_pages, fc->max_pages);
 	data.ia = fuse_io_alloc(NULL, data.max_pages);
-	err = -ENOMEM;
 	if (!data.ia)
-		goto out;
+		return;
 
-	err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
-	if (!err) {
-		if (data.ia->ap.num_pages)
-			fuse_send_readpages(data.ia, file);
-		else
-			fuse_io_free(data.ia);
+	while ((page = readahead_page(rac))) {
+		if (fuse_readpages_fill(&data, page) != 0)
+			return;
 	}
-out:
-	return err;
+
+	if (data.ia->ap.num_pages)
+		fuse_send_readpages(data.ia, rac->file);
+	else
+		fuse_io_free(data.ia);
 }
 
 static ssize_t fuse_cache_read_iter(struct kiocb *iocb, struct iov_iter *to)
@@ -3373,10 +3365,10 @@ static const struct file_operations fuse_file_operations = {
 
 static const struct address_space_operations fuse_file_aops  = {
 	.readpage	= fuse_readpage,
+	.readahead	= fuse_readahead,
 	.writepage	= fuse_writepage,
 	.writepages	= fuse_writepages,
 	.launder_page	= fuse_launder_page,
-	.readpages	= fuse_readpages,
 	.set_page_dirty	= __set_page_dirty_nobuffers,
 	.bmap		= fuse_bmap,
 	.direct_IO	= fuse_direct_IO,
-- 
2.25.1

WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-xfs@vger.kernel.org,
	William Kucharski <william.kucharski@oracle.com>,
	linux-kernel@vger.kernel.org,
	"Matthew Wilcox \(Oracle\)" <willy@infradead.org>,
	linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	linux-mm@kvack.org, ocfs2-devel@oss.oracle.com,
	Dave Chinner <dchinner@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org
Subject: [f2fs-dev] [PATCH v10 24/25] fuse: Convert from readpages to readahead
Date: Mon, 23 Mar 2020 13:22:58 -0700	[thread overview]
Message-ID: <20200323202259.13363-25-willy@infradead.org> (raw)
In-Reply-To: <20200323202259.13363-1-willy@infradead.org>

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Use the new readahead operation in fuse.  Switching away from the
read_cache_pages() helper gets rid of an implicit call to put_page(),
so we can get rid of the get_page() call in fuse_readpages_fill().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
---
 fs/fuse/file.c | 46 +++++++++++++++++++---------------------------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9d67b830fb7a..5749505bcff6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -923,9 +923,8 @@ struct fuse_fill_data {
 	unsigned int max_pages;
 };
 
-static int fuse_readpages_fill(void *_data, struct page *page)
+static int fuse_readpages_fill(struct fuse_fill_data *data, struct page *page)
 {
-	struct fuse_fill_data *data = _data;
 	struct fuse_io_args *ia = data->ia;
 	struct fuse_args_pages *ap = &ia->ap;
 	struct inode *inode = data->inode;
@@ -941,10 +940,8 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 					fc->max_pages);
 		fuse_send_readpages(ia, data->file);
 		data->ia = ia = fuse_io_alloc(NULL, data->max_pages);
-		if (!ia) {
-			unlock_page(page);
+		if (!ia)
 			return -ENOMEM;
-		}
 		ap = &ia->ap;
 	}
 
@@ -954,7 +951,6 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 		return -EIO;
 	}
 
-	get_page(page);
 	ap->pages[ap->num_pages] = page;
 	ap->descs[ap->num_pages].length = PAGE_SIZE;
 	ap->num_pages++;
@@ -962,37 +958,33 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 	return 0;
 }
 
-static int fuse_readpages(struct file *file, struct address_space *mapping,
-			  struct list_head *pages, unsigned nr_pages)
+static void fuse_readahead(struct readahead_control *rac)
 {
-	struct inode *inode = mapping->host;
+	struct inode *inode = rac->mapping->host;
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_fill_data data;
-	int err;
+	struct page *page;
 
-	err = -EIO;
 	if (is_bad_inode(inode))
-		goto out;
+		return;
 
-	data.file = file;
+	data.file = rac->file;
 	data.inode = inode;
-	data.nr_pages = nr_pages;
-	data.max_pages = min_t(unsigned int, nr_pages, fc->max_pages);
-;
+	data.nr_pages = readahead_count(rac);
+	data.max_pages = min_t(unsigned int, data.nr_pages, fc->max_pages);
 	data.ia = fuse_io_alloc(NULL, data.max_pages);
-	err = -ENOMEM;
 	if (!data.ia)
-		goto out;
+		return;
 
-	err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
-	if (!err) {
-		if (data.ia->ap.num_pages)
-			fuse_send_readpages(data.ia, file);
-		else
-			fuse_io_free(data.ia);
+	while ((page = readahead_page(rac))) {
+		if (fuse_readpages_fill(&data, page) != 0)
+			return;
 	}
-out:
-	return err;
+
+	if (data.ia->ap.num_pages)
+		fuse_send_readpages(data.ia, rac->file);
+	else
+		fuse_io_free(data.ia);
 }
 
 static ssize_t fuse_cache_read_iter(struct kiocb *iocb, struct iov_iter *to)
@@ -3373,10 +3365,10 @@ static const struct file_operations fuse_file_operations = {
 
 static const struct address_space_operations fuse_file_aops  = {
 	.readpage	= fuse_readpage,
+	.readahead	= fuse_readahead,
 	.writepage	= fuse_writepage,
 	.writepages	= fuse_writepages,
 	.launder_page	= fuse_launder_page,
-	.readpages	= fuse_readpages,
 	.set_page_dirty	= __set_page_dirty_nobuffers,
 	.bmap		= fuse_bmap,
 	.direct_IO	= fuse_direct_IO,
-- 
2.25.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-xfs@vger.kernel.org,
	William Kucharski <william.kucharski@oracle.com>,
	linux-kernel@vger.kernel.org,
	"Matthew Wilcox \(Oracle\)" <willy@infradead.org>,
	linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com,
	linux-mm@kvack.org, ocfs2-devel@oss.oracle.com,
	Dave Chinner <dchinner@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	linux-erofs@lists.ozlabs.org, linux-btrfs@vger.kernel.org
Subject: [PATCH v10 24/25] fuse: Convert from readpages to readahead
Date: Mon, 23 Mar 2020 13:22:58 -0700	[thread overview]
Message-ID: <20200323202259.13363-25-willy@infradead.org> (raw)
In-Reply-To: <20200323202259.13363-1-willy@infradead.org>

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Use the new readahead operation in fuse.  Switching away from the
read_cache_pages() helper gets rid of an implicit call to put_page(),
so we can get rid of the get_page() call in fuse_readpages_fill().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
---
 fs/fuse/file.c | 46 +++++++++++++++++++---------------------------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9d67b830fb7a..5749505bcff6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -923,9 +923,8 @@ struct fuse_fill_data {
 	unsigned int max_pages;
 };
 
-static int fuse_readpages_fill(void *_data, struct page *page)
+static int fuse_readpages_fill(struct fuse_fill_data *data, struct page *page)
 {
-	struct fuse_fill_data *data = _data;
 	struct fuse_io_args *ia = data->ia;
 	struct fuse_args_pages *ap = &ia->ap;
 	struct inode *inode = data->inode;
@@ -941,10 +940,8 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 					fc->max_pages);
 		fuse_send_readpages(ia, data->file);
 		data->ia = ia = fuse_io_alloc(NULL, data->max_pages);
-		if (!ia) {
-			unlock_page(page);
+		if (!ia)
 			return -ENOMEM;
-		}
 		ap = &ia->ap;
 	}
 
@@ -954,7 +951,6 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 		return -EIO;
 	}
 
-	get_page(page);
 	ap->pages[ap->num_pages] = page;
 	ap->descs[ap->num_pages].length = PAGE_SIZE;
 	ap->num_pages++;
@@ -962,37 +958,33 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 	return 0;
 }
 
-static int fuse_readpages(struct file *file, struct address_space *mapping,
-			  struct list_head *pages, unsigned nr_pages)
+static void fuse_readahead(struct readahead_control *rac)
 {
-	struct inode *inode = mapping->host;
+	struct inode *inode = rac->mapping->host;
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_fill_data data;
-	int err;
+	struct page *page;
 
-	err = -EIO;
 	if (is_bad_inode(inode))
-		goto out;
+		return;
 
-	data.file = file;
+	data.file = rac->file;
 	data.inode = inode;
-	data.nr_pages = nr_pages;
-	data.max_pages = min_t(unsigned int, nr_pages, fc->max_pages);
-;
+	data.nr_pages = readahead_count(rac);
+	data.max_pages = min_t(unsigned int, data.nr_pages, fc->max_pages);
 	data.ia = fuse_io_alloc(NULL, data.max_pages);
-	err = -ENOMEM;
 	if (!data.ia)
-		goto out;
+		return;
 
-	err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
-	if (!err) {
-		if (data.ia->ap.num_pages)
-			fuse_send_readpages(data.ia, file);
-		else
-			fuse_io_free(data.ia);
+	while ((page = readahead_page(rac))) {
+		if (fuse_readpages_fill(&data, page) != 0)
+			return;
 	}
-out:
-	return err;
+
+	if (data.ia->ap.num_pages)
+		fuse_send_readpages(data.ia, rac->file);
+	else
+		fuse_io_free(data.ia);
 }
 
 static ssize_t fuse_cache_read_iter(struct kiocb *iocb, struct iov_iter *to)
@@ -3373,10 +3365,10 @@ static const struct file_operations fuse_file_operations = {
 
 static const struct address_space_operations fuse_file_aops  = {
 	.readpage	= fuse_readpage,
+	.readahead	= fuse_readahead,
 	.writepage	= fuse_writepage,
 	.writepages	= fuse_writepages,
 	.launder_page	= fuse_launder_page,
-	.readpages	= fuse_readpages,
 	.set_page_dirty	= __set_page_dirty_nobuffers,
 	.bmap		= fuse_bmap,
 	.direct_IO	= fuse_direct_IO,
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Matthew Wilcox <willy@infradead.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH v10 24/25] fuse: Convert from readpages to readahead
Date: Mon, 23 Mar 2020 13:22:58 -0700	[thread overview]
Message-ID: <20200323202259.13363-25-willy@infradead.org> (raw)
In-Reply-To: <20200323202259.13363-1-willy@infradead.org>

From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Use the new readahead operation in fuse.  Switching away from the
read_cache_pages() helper gets rid of an implicit call to put_page(),
so we can get rid of the get_page() call in fuse_readpages_fill().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
---
 fs/fuse/file.c | 46 +++++++++++++++++++---------------------------
 1 file changed, 19 insertions(+), 27 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9d67b830fb7a..5749505bcff6 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -923,9 +923,8 @@ struct fuse_fill_data {
 	unsigned int max_pages;
 };
 
-static int fuse_readpages_fill(void *_data, struct page *page)
+static int fuse_readpages_fill(struct fuse_fill_data *data, struct page *page)
 {
-	struct fuse_fill_data *data = _data;
 	struct fuse_io_args *ia = data->ia;
 	struct fuse_args_pages *ap = &ia->ap;
 	struct inode *inode = data->inode;
@@ -941,10 +940,8 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 					fc->max_pages);
 		fuse_send_readpages(ia, data->file);
 		data->ia = ia = fuse_io_alloc(NULL, data->max_pages);
-		if (!ia) {
-			unlock_page(page);
+		if (!ia)
 			return -ENOMEM;
-		}
 		ap = &ia->ap;
 	}
 
@@ -954,7 +951,6 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 		return -EIO;
 	}
 
-	get_page(page);
 	ap->pages[ap->num_pages] = page;
 	ap->descs[ap->num_pages].length = PAGE_SIZE;
 	ap->num_pages++;
@@ -962,37 +958,33 @@ static int fuse_readpages_fill(void *_data, struct page *page)
 	return 0;
 }
 
-static int fuse_readpages(struct file *file, struct address_space *mapping,
-			  struct list_head *pages, unsigned nr_pages)
+static void fuse_readahead(struct readahead_control *rac)
 {
-	struct inode *inode = mapping->host;
+	struct inode *inode = rac->mapping->host;
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_fill_data data;
-	int err;
+	struct page *page;
 
-	err = -EIO;
 	if (is_bad_inode(inode))
-		goto out;
+		return;
 
-	data.file = file;
+	data.file = rac->file;
 	data.inode = inode;
-	data.nr_pages = nr_pages;
-	data.max_pages = min_t(unsigned int, nr_pages, fc->max_pages);
-;
+	data.nr_pages = readahead_count(rac);
+	data.max_pages = min_t(unsigned int, data.nr_pages, fc->max_pages);
 	data.ia = fuse_io_alloc(NULL, data.max_pages);
-	err = -ENOMEM;
 	if (!data.ia)
-		goto out;
+		return;
 
-	err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
-	if (!err) {
-		if (data.ia->ap.num_pages)
-			fuse_send_readpages(data.ia, file);
-		else
-			fuse_io_free(data.ia);
+	while ((page = readahead_page(rac))) {
+		if (fuse_readpages_fill(&data, page) != 0)
+			return;
 	}
-out:
-	return err;
+
+	if (data.ia->ap.num_pages)
+		fuse_send_readpages(data.ia, rac->file);
+	else
+		fuse_io_free(data.ia);
 }
 
 static ssize_t fuse_cache_read_iter(struct kiocb *iocb, struct iov_iter *to)
@@ -3373,10 +3365,10 @@ static const struct file_operations fuse_file_operations = {
 
 static const struct address_space_operations fuse_file_aops  = {
 	.readpage	= fuse_readpage,
+	.readahead	= fuse_readahead,
 	.writepage	= fuse_writepage,
 	.writepages	= fuse_writepages,
 	.launder_page	= fuse_launder_page,
-	.readpages	= fuse_readpages,
 	.set_page_dirty	= __set_page_dirty_nobuffers,
 	.bmap		= fuse_bmap,
 	.direct_IO	= fuse_direct_IO,
-- 
2.25.1




  parent reply	other threads:[~2020-03-23 20:23 UTC|newest]

Thread overview: 173+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 20:22 [PATCH v10 00/25] Change readahead API Matthew Wilcox
2020-03-23 20:22 ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22 ` Matthew Wilcox
2020-03-23 20:22 ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22 ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 01/25] mm: Move readahead prototypes from mm.h Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 02/25] mm: Return void from various readahead functions Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 03/25] mm: Ignore return value of ->readpages Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 04/25] mm: Move readahead nr_pages check into read_pages Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 05/25] mm: Add new readahead_control API Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 06/25] mm: Use readahead_control to pass arguments Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 07/25] mm: Rename various 'offset' parameters to 'index' Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 08/25] mm: rename readahead loop variable to 'i' Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 09/25] mm: Remove 'page_offset' from readahead loop Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 10/25] mm: Put readahead pages in cache earlier Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 11/25] mm: Add readahead address space operation Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 12/25] mm: Move end_index check out of readahead loop Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:49   ` Eric Biggers
2020-03-23 20:49     ` [Cluster-devel] " Eric Biggers
2020-03-23 20:49     ` Eric Biggers
2020-03-23 20:49     ` [f2fs-dev] " Eric Biggers
2020-03-23 20:49     ` [Ocfs2-devel] " Eric Biggers
2020-03-24  8:40   ` Christoph Hellwig
2020-03-24  8:40     ` [Cluster-devel] " Christoph Hellwig
2020-03-24  8:40     ` Christoph Hellwig
2020-03-24  8:40     ` [f2fs-dev] " Christoph Hellwig
2020-03-24  8:40     ` [Ocfs2-devel] " Christoph Hellwig
2020-03-23 20:22 ` [PATCH v10 13/25] mm: Add page_cache_readahead_unbounded Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 14/25] mm: Document why we don't set PageReadahead Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 15/25] mm: Use memalloc_nofs_save in readahead path Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 16/25] fs: Convert mpage_readpages to mpage_readahead Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 17/25] btrfs: Convert from readpages to readahead Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-26 16:53   ` David Sterba
2020-03-26 16:53     ` [Cluster-devel] " David Sterba
2020-03-26 16:53     ` David Sterba
2020-03-26 16:53     ` [f2fs-dev] " David Sterba
2020-03-26 16:53     ` [Ocfs2-devel] " David Sterba
2020-03-23 20:22 ` [PATCH v10 18/25] erofs: Convert uncompressed files " Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 19/25] erofs: Convert compressed " Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 20/25] ext4: Convert " Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 21/25] ext4: Pass the inode to ext4_mpage_readpages Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 22/25] f2fs: Convert from readpages to readahead Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` [PATCH v10 23/25] f2fs: Pass the inode to f2fs_mpage_readpages Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-23 20:22 ` Matthew Wilcox [this message]
2020-03-23 20:22   ` [Cluster-devel] [PATCH v10 24/25] fuse: Convert from readpages to readahead Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox
2020-03-25  9:42   ` Miklos Szeredi
2020-03-25  9:42     ` [Cluster-devel] " Miklos Szeredi
2020-03-25  9:42     ` Miklos Szeredi
2020-03-25  9:42     ` [f2fs-dev] " Miklos Szeredi
2020-03-25  9:42     ` Miklos Szeredi
2020-03-25  9:42     ` [Ocfs2-devel] " Miklos Szeredi
2020-03-25 12:02     ` Matthew Wilcox
2020-03-25 12:02       ` [Cluster-devel] " Matthew Wilcox
2020-03-25 12:02       ` Matthew Wilcox
2020-03-25 12:02       ` [f2fs-dev] " Matthew Wilcox
2020-03-25 12:02       ` [Ocfs2-devel] " Matthew Wilcox
2020-03-25 14:43       ` Miklos Szeredi
2020-03-25 14:43         ` [Cluster-devel] " Miklos Szeredi
2020-03-25 14:43         ` Miklos Szeredi
2020-03-25 14:43         ` [f2fs-dev] " Miklos Szeredi
2020-03-25 14:43         ` Miklos Szeredi
2020-03-25 14:43         ` [Ocfs2-devel] " Miklos Szeredi
2020-03-25 15:32         ` Matthew Wilcox
2020-03-25 15:32           ` [Cluster-devel] " Matthew Wilcox
2020-03-25 15:32           ` Matthew Wilcox
2020-03-25 15:32           ` [f2fs-dev] " Matthew Wilcox
2020-03-25 15:32           ` [Ocfs2-devel] " Matthew Wilcox
2020-03-25 15:54           ` Miklos Szeredi
2020-03-25 15:54             ` [Cluster-devel] " Miklos Szeredi
2020-03-25 15:54             ` Miklos Szeredi
2020-03-25 15:54             ` [f2fs-dev] " Miklos Szeredi
2020-03-25 15:54             ` Miklos Szeredi
2020-03-25 15:54             ` [Ocfs2-devel] " Miklos Szeredi
2020-03-23 20:22 ` [PATCH v10 25/25] iomap: " Matthew Wilcox
2020-03-23 20:22   ` [Cluster-devel] " Matthew Wilcox
2020-03-23 20:22   ` Matthew Wilcox
2020-03-23 20:22   ` [f2fs-dev] " Matthew Wilcox
2020-03-23 20:22   ` [Ocfs2-devel] " Matthew Wilcox

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=20200323202259.13363-25-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=cluster-devel@redhat.com \
    --cc=dchinner@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=william.kucharski@oracle.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: link
Be 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.