diff mbox series

[v3,02/10] fuse: convert fuse_send_write_pages to use folios

Message ID f0e70cb0b99f46d05385705095fb9413a6c9ef0e.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:44 p.m. UTC
Convert this to grab the folio from the fuse_args_pages and use the
appropriate folio related functions.

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/fuse/file.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Joanne Koong Sept. 27, 2024, 10:24 p.m. UTC | #1
On Fri, Sep 27, 2024 at 1:46 PM Josef Bacik <josef@toxicpanda.com> wrote:
>
> Convert this to grab the folio from the fuse_args_pages and use the
> appropriate folio related functions.
>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Joanne Koong <joannelkoong@gmail.com>

> ---
>  fs/fuse/file.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 132528cde745..17ac2de61cdb 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -1168,23 +1168,23 @@ static ssize_t fuse_send_write_pages(struct fuse_io_args *ia,
>         offset = ap->descs[0].offset;
>         count = ia->write.out.size;
>         for (i = 0; i < ap->num_pages; i++) {
> -               struct page *page = ap->pages[i];
> +               struct folio *folio = page_folio(ap->pages[i]);
>
>                 if (err) {
> -                       ClearPageUptodate(page);
> +                       folio_clear_uptodate(folio);
>                 } else {
> -                       if (count >= PAGE_SIZE - offset)
> -                               count -= PAGE_SIZE - offset;
> +                       if (count >= folio_size(folio) - offset)
> +                               count -= folio_size(folio) - offset;
>                         else {
>                                 if (short_write)
> -                                       ClearPageUptodate(page);
> +                                       folio_clear_uptodate(folio);
>                                 count = 0;
>                         }
>                         offset = 0;
>                 }
>                 if (ia->write.page_locked && (i == ap->num_pages - 1))
> -                       unlock_page(page);
> -               put_page(page);
> +                       folio_unlock(folio);
> +               folio_put(folio);
>         }
>
>         return err;
> --
> 2.43.0
>
>
diff mbox series

Patch

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 132528cde745..17ac2de61cdb 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1168,23 +1168,23 @@  static ssize_t fuse_send_write_pages(struct fuse_io_args *ia,
 	offset = ap->descs[0].offset;
 	count = ia->write.out.size;
 	for (i = 0; i < ap->num_pages; i++) {
-		struct page *page = ap->pages[i];
+		struct folio *folio = page_folio(ap->pages[i]);
 
 		if (err) {
-			ClearPageUptodate(page);
+			folio_clear_uptodate(folio);
 		} else {
-			if (count >= PAGE_SIZE - offset)
-				count -= PAGE_SIZE - offset;
+			if (count >= folio_size(folio) - offset)
+				count -= folio_size(folio) - offset;
 			else {
 				if (short_write)
-					ClearPageUptodate(page);
+					folio_clear_uptodate(folio);
 				count = 0;
 			}
 			offset = 0;
 		}
 		if (ia->write.page_locked && (i == ap->num_pages - 1))
-			unlock_page(page);
-		put_page(page);
+			folio_unlock(folio);
+		folio_put(folio);
 	}
 
 	return err;