diff mbox series

[v3,09/10] fuse: convert fuse_retrieve to use folios

Message ID 5b0e4f2c48a04d66dfe70f8228b05ebc53be6a00.1727469663.git.josef@toxicpanda.com (mailing list archive)
State New
Headers show
Series fuse: folio conversions | expand

Commit Message

Josef Bacik Sept. 27, 2024, 8:45 p.m. UTC
We're just looking for pages in a mapping, use a folio and the folio
lookup function directly instead of using the page helper.

Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/fuse/dev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Joanne Koong Sept. 27, 2024, 10:59 p.m. UTC | #1
On Fri, Sep 27, 2024 at 1:45 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> We're just looking for pages in a mapping, use a folio and the folio
> lookup function directly instead of using the page helper.
>
> Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  fs/fuse/dev.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index 1f64ae6d7a69..4c58113eb6a1 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -1756,15 +1756,15 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
>         index = outarg->offset >> PAGE_SHIFT;
>
>         while (num && ap->num_pages < num_pages) {
> -               struct page *page;
> +               struct folio *folio;
>                 unsigned int this_num;
>
> -               page = find_get_page(mapping, index);
> -               if (!page)
> +               folio = __filemap_get_folio(mapping, index, 0, 0);

I think you can also just use "filemap_get_folio(mapping, index);" here

> +               if (IS_ERR(folio))
>                         break;
>
>                 this_num = min_t(unsigned, num, PAGE_SIZE - offset);
> -               ap->pages[ap->num_pages] = page;
> +               ap->pages[ap->num_pages] = &folio->page;
>                 ap->descs[ap->num_pages].offset = offset;
>                 ap->descs[ap->num_pages].length = this_num;
>                 ap->num_pages++;
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 1f64ae6d7a69..4c58113eb6a1 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1756,15 +1756,15 @@  static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
 	index = outarg->offset >> PAGE_SHIFT;
 
 	while (num && ap->num_pages < num_pages) {
-		struct page *page;
+		struct folio *folio;
 		unsigned int this_num;
 
-		page = find_get_page(mapping, index);
-		if (!page)
+		folio = __filemap_get_folio(mapping, index, 0, 0);
+		if (IS_ERR(folio))
 			break;
 
 		this_num = min_t(unsigned, num, PAGE_SIZE - offset);
-		ap->pages[ap->num_pages] = page;
+		ap->pages[ap->num_pages] = &folio->page;
 		ap->descs[ap->num_pages].offset = offset;
 		ap->descs[ap->num_pages].length = this_num;
 		ap->num_pages++;