]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
buffer: use b_folio in mark_buffer_dirty()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 15 Dec 2022 21:43:57 +0000 (21:43 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 19 Jan 2023 01:12:40 +0000 (17:12 -0800)
Removes about four calls to compound_head().  Two of them are inline which
removes 132 bytes from the kernel text.

Link: https://lkml.kernel.org/r/20221215214402.3522366-8-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/buffer.c

index c44ca40530c38de071da9cb0ee29cbe39481cbff..7e42d67bcaadf7178d9a8d6789af0d402ced2473 100644 (file)
@@ -1095,16 +1095,16 @@ void mark_buffer_dirty(struct buffer_head *bh)
        }
 
        if (!test_set_buffer_dirty(bh)) {
-               struct page *page = bh->b_page;
+               struct folio *folio = bh->b_folio;
                struct address_space *mapping = NULL;
 
-               lock_page_memcg(page);
-               if (!TestSetPageDirty(page)) {
-                       mapping = page_mapping(page);
+               folio_memcg_lock(folio);
+               if (!folio_test_set_dirty(folio)) {
+                       mapping = folio->mapping;
                        if (mapping)
-                               __set_page_dirty(page, mapping, 0);
+                               __folio_mark_dirty(folio, mapping, 0);
                }
-               unlock_page_memcg(page);
+               folio_memcg_unlock(folio);
                if (mapping)
                        __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
        }