]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
buffer: Convert __block_write_full_folio to __bh_submit()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 28 May 2026 17:31:24 +0000 (18:31 +0100)
committerChristian Brauner <brauner@kernel.org>
Thu, 4 Jun 2026 08:28:07 +0000 (10:28 +0200)
Avoid an extra indirect function call by using __bh_submit() instead
of submit_bh_wbc().  Since there is only one caller of submit_bh_wbc()
left, inline it into submit_bh().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://patch.msgid.link/20260528173150.1093780-12-willy@infradead.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/buffer.c

index b668a73d48ece1d20aab2b25fc3cffe03c6d79d6..50bcef50a4a4f77f01c64b064a7ecdbbda0b8f00 100644 (file)
@@ -1271,14 +1271,6 @@ static void __bh_submit(struct buffer_head *bh, blk_opf_t opf,
        blk_crypto_submit_bio(bio);
 }
 
-static void submit_bh_wbc(blk_opf_t opf, struct buffer_head *bh,
-                         enum rw_hint write_hint,
-                         struct writeback_control *wbc)
-{
-       BUG_ON(!bh->b_end_io);
-       __bh_submit(bh, opf, write_hint, wbc, end_bio_bh_io_sync);
-}
-
 /**
  * bh_submit - Start I/O against a buffer head
  * @bh: The buffer head to perform I/O on.
@@ -1945,7 +1937,7 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio,
                        continue;
                }
                if (test_clear_buffer_dirty(bh)) {
-                       mark_buffer_async_write(bh);
+                       set_buffer_async_write(bh);
                } else {
                        unlock_buffer(bh);
                }
@@ -1961,8 +1953,9 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio,
        do {
                struct buffer_head *next = bh->b_this_page;
                if (buffer_async_write(bh)) {
-                       submit_bh_wbc(REQ_OP_WRITE | write_flags, bh,
-                                     inode->i_write_hint, wbc);
+                       __bh_submit(bh, REQ_OP_WRITE | write_flags,
+                                       inode->i_write_hint, wbc,
+                                       bh_end_async_write);
                        nr_underway++;
                }
                bh = next;
@@ -1999,7 +1992,7 @@ recover:
                if (buffer_mapped(bh) && buffer_dirty(bh) &&
                    !buffer_delay(bh)) {
                        lock_buffer(bh);
-                       mark_buffer_async_write(bh);
+                       set_buffer_async_write(bh);
                } else {
                        /*
                         * The buffer may have been set dirty during
@@ -2015,8 +2008,9 @@ recover:
                struct buffer_head *next = bh->b_this_page;
                if (buffer_async_write(bh)) {
                        clear_buffer_dirty(bh);
-                       submit_bh_wbc(REQ_OP_WRITE | write_flags, bh,
-                                     inode->i_write_hint, wbc);
+                       __bh_submit(bh, REQ_OP_WRITE | write_flags,
+                                       inode->i_write_hint, wbc,
+                                       bh_end_async_write);
                        nr_underway++;
                }
                bh = next;
@@ -2822,7 +2816,8 @@ EXPORT_SYMBOL(generic_block_bmap);
 
 void submit_bh(blk_opf_t opf, struct buffer_head *bh)
 {
-       submit_bh_wbc(opf, bh, WRITE_LIFE_NOT_SET, NULL);
+       BUG_ON(!bh->b_end_io);
+       __bh_submit(bh, opf, WRITE_LIFE_NOT_SET, NULL, end_bio_bh_io_sync);
 }
 EXPORT_SYMBOL(submit_bh);