@@ -1728,7 +1728,7 @@ static void fuse_retrieve_end(struct fuse_mount *fm, struct fuse_args *args,
17281728 struct fuse_retrieve_args * ra =
17291729 container_of (args , typeof (* ra ), ap .args );
17301730
1731- release_pages (ra -> ap .pages , ra -> ap .num_pages );
1731+ release_pages (ra -> ap .folios , ra -> ap .num_folios );
17321732 kfree (ra );
17331733}
17341734
@@ -1742,7 +1742,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
17421742 unsigned int num ;
17431743 unsigned int offset ;
17441744 size_t total_len = 0 ;
1745- unsigned int num_pages ;
1745+ unsigned int num_pages , cur_pages = 0 ;
17461746 struct fuse_conn * fc = fm -> fc ;
17471747 struct fuse_retrieve_args * ra ;
17481748 size_t args_size = sizeof (* ra );
@@ -1761,15 +1761,16 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
17611761 num_pages = (num + offset + PAGE_SIZE - 1 ) >> PAGE_SHIFT ;
17621762 num_pages = min (num_pages , fc -> max_pages );
17631763
1764- args_size += num_pages * (sizeof (ap -> pages [0 ]) + sizeof (ap -> descs [0 ]));
1764+ args_size += num_pages * (sizeof (ap -> folios [0 ]) + sizeof (ap -> folio_descs [0 ]));
17651765
17661766 ra = kzalloc (args_size , GFP_KERNEL );
17671767 if (!ra )
17681768 return - ENOMEM ;
17691769
17701770 ap = & ra -> ap ;
1771- ap -> pages = (void * ) (ra + 1 );
1772- ap -> descs = (void * ) (ap -> pages + num_pages );
1771+ ap -> folios = (void * ) (ra + 1 );
1772+ ap -> folio_descs = (void * ) (ap -> folios + num_pages );
1773+ ap -> uses_folios = true;
17731774
17741775 args = & ap -> args ;
17751776 args -> nodeid = outarg -> nodeid ;
@@ -1780,7 +1781,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
17801781
17811782 index = outarg -> offset >> PAGE_SHIFT ;
17821783
1783- while (num && ap -> num_pages < num_pages ) {
1784+ while (num && cur_pages < num_pages ) {
17841785 struct folio * folio ;
17851786 unsigned int this_num ;
17861787
@@ -1789,10 +1790,11 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
17891790 break ;
17901791
17911792 this_num = min_t (unsigned , num , PAGE_SIZE - offset );
1792- ap -> pages [ap -> num_pages ] = & folio -> page ;
1793- ap -> descs [ap -> num_pages ].offset = offset ;
1794- ap -> descs [ap -> num_pages ].length = this_num ;
1795- ap -> num_pages ++ ;
1793+ ap -> folios [ap -> num_folios ] = folio ;
1794+ ap -> folio_descs [ap -> num_folios ].offset = offset ;
1795+ ap -> folio_descs [ap -> num_folios ].length = this_num ;
1796+ ap -> num_folios ++ ;
1797+ cur_pages ++ ;
17961798
17971799 offset = 0 ;
17981800 num -= this_num ;
0 commit comments