On Tue, Oct 22, 2024 at 11:54 AM Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > > Convert retrieve requests to use folios instead of pages. > > No functional changes. > > Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx> > Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> > --- > fs/fuse/dev.c | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > > diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c > index 9f860bd655a4..220b1bddb74e 100644 > --- a/fs/fuse/dev.c > +++ b/fs/fuse/dev.c > @@ -1728,7 +1728,7 @@ static void fuse_retrieve_end(struct fuse_mount *fm, struct fuse_args *args, > struct fuse_retrieve_args *ra = > container_of(args, typeof(*ra), ap.args); > > - release_pages(ra->ap.pages, ra->ap.num_pages); > + release_pages(ra->ap.folios, ra->ap.num_folios); > kfree(ra); > } > > @@ -1742,7 +1742,8 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, > unsigned int num; > unsigned int offset; > size_t total_len = 0; > - unsigned int num_pages; > + unsigned int num_folios; > + unsigned int num_pages, cur_pages = 0; > struct fuse_conn *fc = fm->fc; > struct fuse_retrieve_args *ra; > size_t args_size = sizeof(*ra); > @@ -1761,15 +1762,16 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, > num_pages = (num + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; > num_pages = min(num_pages, fc->max_pages); > > - args_size += num_pages * (sizeof(ap->pages[0]) + sizeof(ap->descs[0])); > + args_size += num_pages * (sizeof(ap->folios[0]) + sizeof(ap->folio_descs[0])); > > ra = kzalloc(args_size, GFP_KERNEL); > if (!ra) > return -ENOMEM; > > ap = &ra->ap; > - ap->pages = (void *) (ra + 1); > - ap->descs = (void *) (ap->pages + num_pages); > + ap->folios = (void *) (ra + 1); > + ap->folio_descs = (void *) (ap->folios + num_folios); Agh, I messed this up in the refactoring I did between v1 -> v2. This should be ap->folios + num_pages. Will fix this in v3. > + ap->uses_folios = true; > > args = &ap->args; > args->nodeid = outarg->nodeid; > @@ -1780,7 +1782,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, > > index = outarg->offset >> PAGE_SHIFT; > > - while (num && ap->num_pages < num_pages) { > + while (num && cur_pages < num_pages) { > struct folio *folio; > unsigned int this_num; > > @@ -1789,10 +1791,11 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, > break; > > this_num = min_t(unsigned, num, PAGE_SIZE - offset); > - 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++; > + ap->folios[ap->num_folios] = folio; > + ap->folio_descs[ap->num_folios].offset = offset; > + ap->folio_descs[ap->num_folios].length = this_num; > + ap->num_folios++; > + cur_pages++; > > offset = 0; > num -= this_num; > -- > 2.43.5 >