Skip to content

Commit 65fe891

Browse files
josefbacikMiklos Szeredi
authored andcommitted
fuse: convert fuse_do_readpage to use folios
Now that the buffered write path is using folios, convert fuse_do_readpage() to take a folio instead of a page, update it to use the appropriate folio helpers, and update the callers to pass in the folio directly instead of a page. Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: Joanne Koong <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent e6befec commit 65fe891

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

fs/fuse/file.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,13 @@ static void fuse_short_read(struct inode *inode, u64 attr_ver, size_t num_read,
865865
}
866866
}
867867

868-
static int fuse_do_readpage(struct file *file, struct page *page)
868+
static int fuse_do_readfolio(struct file *file, struct folio *folio)
869869
{
870-
struct inode *inode = page->mapping->host;
870+
struct inode *inode = folio->mapping->host;
871871
struct fuse_mount *fm = get_fuse_mount(inode);
872-
loff_t pos = page_offset(page);
872+
loff_t pos = folio_pos(folio);
873873
struct fuse_page_desc desc = { .length = PAGE_SIZE };
874+
struct page *page = &folio->page;
874875
struct fuse_io_args ia = {
875876
.ap.args.page_zeroing = true,
876877
.ap.args.out_pages = true,
@@ -882,11 +883,11 @@ static int fuse_do_readpage(struct file *file, struct page *page)
882883
u64 attr_ver;
883884

884885
/*
885-
* Page writeback can extend beyond the lifetime of the
886-
* page-cache page, so make sure we read a properly synced
887-
* page.
886+
* With the temporary pages that are used to complete writeback, we can
887+
* have writeback that extends beyond the lifetime of the folio. So
888+
* make sure we read a properly synced folio.
888889
*/
889-
fuse_wait_on_page_writeback(inode, page->index);
890+
fuse_wait_on_folio_writeback(inode, folio);
890891

891892
attr_ver = fuse_get_attr_version(fm->fc);
892893

@@ -904,25 +905,24 @@ static int fuse_do_readpage(struct file *file, struct page *page)
904905
if (res < desc.length)
905906
fuse_short_read(inode, attr_ver, res, &ia.ap);
906907

907-
SetPageUptodate(page);
908+
folio_mark_uptodate(folio);
908909

909910
return 0;
910911
}
911912

912913
static int fuse_read_folio(struct file *file, struct folio *folio)
913914
{
914-
struct page *page = &folio->page;
915-
struct inode *inode = page->mapping->host;
915+
struct inode *inode = folio->mapping->host;
916916
int err;
917917

918918
err = -EIO;
919919
if (fuse_is_bad(inode))
920920
goto out;
921921

922-
err = fuse_do_readpage(file, page);
922+
err = fuse_do_readfolio(file, folio);
923923
fuse_invalidate_atime(inode);
924924
out:
925-
unlock_page(page);
925+
folio_unlock(folio);
926926
return err;
927927
}
928928

@@ -2475,7 +2475,7 @@ static int fuse_write_begin(struct file *file, struct address_space *mapping,
24752475
folio_zero_segment(folio, 0, off);
24762476
goto success;
24772477
}
2478-
err = fuse_do_readpage(file, &folio->page);
2478+
err = fuse_do_readfolio(file, folio);
24792479
if (err)
24802480
goto cleanup;
24812481
success:

0 commit comments

Comments
 (0)