diff mbox series

[02/11] fuse: convert fuse_send_write_pages to use folios

Message ID ce4dd66436ee3a19cbe4fba10daa47c1f2a0421c.1724791233.git.josef@toxicpanda.com (mailing list archive)
State New
Headers show
Series fuse: convert to using folios and iomap | expand

Commit Message

Josef Bacik Aug. 27, 2024, 8:45 p.m. UTC
Convert this to grab the folio from the fuse_args_pages and use the
appropriate folio related functions.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/fuse/file.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Matthew Wilcox Aug. 27, 2024, 9:53 p.m. UTC | #1
On Tue, Aug 27, 2024 at 04:45:15PM -0400, Josef Bacik wrote:
>  	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;

I'd tend to adjust these to folio_size() while doing this function,
just so that I don't have to come back to it later.

Either way,

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Josef Bacik Aug. 27, 2024, 10:24 p.m. UTC | #2
On Tue, Aug 27, 2024 at 10:53:58PM +0100, Matthew Wilcox wrote:
> On Tue, Aug 27, 2024 at 04:45:15PM -0400, Josef Bacik wrote:
> >  	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;
> 
> I'd tend to adjust these to folio_size() while doing this function,
> just so that I don't have to come back to it later.
> 
> Either way,
> 
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Same, I just glossed over this one because we weren't touching the folio
directly, I'll fix it up since I have to respin the series anyway.  Thanks,

Josef
diff mbox series

Patch

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 5024bc5a1da2..3621dbc17167 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1177,23 +1177,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;
 			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;