On Tue, Aug 27, 2024 at 1:46 PM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote: > > Convert this to grab the folio directly, and update all the helpers to > use the folio related functions. > > Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx> > --- > fs/fuse/file.c | 28 +++++++++++++++------------- > 1 file changed, 15 insertions(+), 13 deletions(-) > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > index 3621dbc17167..8cd3911446b6 100644 > --- a/fs/fuse/file.c > +++ b/fs/fuse/file.c > @@ -1215,7 +1215,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia, > > do { > size_t tmp; > - struct page *page; > + struct folio *folio; > pgoff_t index = pos >> PAGE_SHIFT; > size_t bytes = min_t(size_t, PAGE_SIZE - offset, > iov_iter_count(ii)); > @@ -1227,25 +1227,27 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia, > if (fault_in_iov_iter_readable(ii, bytes)) > break; > > - err = -ENOMEM; > - page = grab_cache_page_write_begin(mapping, index); > - if (!page) > + folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN, > + mapping_gfp_mask(mapping)); > + if (!IS_ERR(folio)) { I think you meant to put IS_ERR here instead of !IS_ERR? > + err = PTR_ERR(folio); > break; > + } > > if (mapping_writably_mapped(mapping)) > - flush_dcache_page(page); > + flush_dcache_folio(folio); > > - tmp = copy_page_from_iter_atomic(page, offset, bytes, ii); > - flush_dcache_page(page); > + tmp = copy_folio_from_iter_atomic(folio, offset, bytes, ii); > + flush_dcache_folio(folio); > > if (!tmp) { > - unlock_page(page); > - put_page(page); > + folio_unlock(folio); > + folio_put(folio); > goto again; > } > > err = 0; > - ap->pages[ap->num_pages] = page; > + ap->pages[ap->num_pages] = &folio->page; > ap->descs[ap->num_pages].length = tmp; > ap->num_pages++; > > @@ -1257,10 +1259,10 @@ static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia, > > /* If we copied full page, mark it uptodate */ > if (tmp == PAGE_SIZE) > - SetPageUptodate(page); > + folio_mark_uptodate(folio); > > - if (PageUptodate(page)) { > - unlock_page(page); > + if (folio_test_uptodate(folio)) { > + folio_unlock(folio); > } else { > ia->write.page_locked = true; > break; > -- > 2.43.0 >