]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fuse: Convert fuse_write_end() to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 10 Jul 2024 20:42:35 +0000 (16:42 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 7 Aug 2024 09:32:00 +0000 (11:32 +0200)
Convert the passed page to a folio and operate on that.
Replaces five calls to compound_head() with one.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fuse/file.c

index f39456c65ed7f7934a35b59e1ee8d7c5db1e90c7..f4102c6657af7dea65a6be975a126a95d03fc516 100644 (file)
@@ -2434,29 +2434,30 @@ static int fuse_write_end(struct file *file, struct address_space *mapping,
                loff_t pos, unsigned len, unsigned copied,
                struct page *page, void *fsdata)
 {
-       struct inode *inode = page->mapping->host;
+       struct folio *folio = page_folio(page);
+       struct inode *inode = folio->mapping->host;
 
        /* Haven't copied anything?  Skip zeroing, size extending, dirtying. */
        if (!copied)
                goto unlock;
 
        pos += copied;
-       if (!PageUptodate(page)) {
+       if (!folio_test_uptodate(folio)) {
                /* Zero any unwritten bytes at the end of the page */
                size_t endoff = pos & ~PAGE_MASK;
                if (endoff)
-                       zero_user_segment(page, endoff, PAGE_SIZE);
-               SetPageUptodate(page);
+                       folio_zero_segment(folio, endoff, PAGE_SIZE);
+               folio_mark_uptodate(folio);
        }
 
        if (pos > inode->i_size)
                i_size_write(inode, pos);
 
-       set_page_dirty(page);
+       folio_mark_dirty(folio);
 
 unlock:
-       unlock_page(page);
-       put_page(page);
+       folio_unlock(folio);
+       folio_put(folio);
 
        return copied;
 }