]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
buffer: Use a folio in generic_write_end()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 10 Jul 2024 17:46:15 +0000 (13:46 -0400)
committerChristian Brauner <brauner@kernel.org>
Wed, 7 Aug 2024 09:31:59 +0000 (11:31 +0200)
Replaces two implicit 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/buffer.c

index a9aeb04da3981416ea2bbf639b86628e1723c8a0..4483388108021e52e7f39d528f3ed24d650dcba8 100644 (file)
@@ -2283,6 +2283,7 @@ int generic_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
                        struct page *page, void *fsdata)
 {
+       struct folio *folio = page_folio(page);
        struct inode *inode = mapping->host;
        loff_t old_size = inode->i_size;
        bool i_size_changed = false;
@@ -2293,7 +2294,7 @@ int generic_write_end(struct file *file, struct address_space *mapping,
         * No need to use i_size_read() here, the i_size cannot change under us
         * because we hold i_rwsem.
         *
-        * But it's important to update i_size while still holding page lock:
+        * But it's important to update i_size while still holding folio lock:
         * page writeout could otherwise come in and zero beyond i_size.
         */
        if (pos + copied > inode->i_size) {
@@ -2301,8 +2302,8 @@ int generic_write_end(struct file *file, struct address_space *mapping,
                i_size_changed = true;
        }
 
-       unlock_page(page);
-       put_page(page);
+       folio_unlock(folio);
+       folio_put(folio);
 
        if (old_size < pos)
                pagecache_isize_extended(inode, old_size, pos);