Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: remove the bh_end_io argument from __block_write_full_folio

All callers are passing end_buffer_async_write as this argument, so we can
hardcode references to it within __block_write_full_folio(). That lets us
make end_buffer_async_write() static.

Link: https://lkml.kernel.org/r/20231215200245.748418-15-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
14059f66 17bf23a9

+12 -16
+10 -12
fs/buffer.c
··· 372 372 } 373 373 374 374 /* 375 - * Completion handler for block_write_full_folio() - pages which are unlocked 376 - * during I/O, and which have PageWriteback cleared upon I/O completion. 375 + * Completion handler for block_write_full_folio() - folios which are unlocked 376 + * during I/O, and which have the writeback flag cleared upon I/O completion. 377 377 */ 378 - void end_buffer_async_write(struct buffer_head *bh, int uptodate) 378 + static void end_buffer_async_write(struct buffer_head *bh, int uptodate) 379 379 { 380 380 unsigned long flags; 381 381 struct buffer_head *first; ··· 415 415 spin_unlock_irqrestore(&first->b_uptodate_lock, flags); 416 416 return; 417 417 } 418 - EXPORT_SYMBOL(end_buffer_async_write); 419 418 420 419 /* 421 420 * If a page's buffers are under async readin (end_buffer_async_read ··· 1786 1787 * causes the writes to be flagged as synchronous writes. 1787 1788 */ 1788 1789 int __block_write_full_folio(struct inode *inode, struct folio *folio, 1789 - get_block_t *get_block, struct writeback_control *wbc, 1790 - bh_end_io_t *handler) 1790 + get_block_t *get_block, struct writeback_control *wbc) 1791 1791 { 1792 1792 int err; 1793 1793 sector_t block; ··· 1865 1867 continue; 1866 1868 } 1867 1869 if (test_clear_buffer_dirty(bh)) { 1868 - mark_buffer_async_write_endio(bh, handler); 1870 + mark_buffer_async_write_endio(bh, 1871 + end_buffer_async_write); 1869 1872 } else { 1870 1873 unlock_buffer(bh); 1871 1874 } ··· 1919 1920 if (buffer_mapped(bh) && buffer_dirty(bh) && 1920 1921 !buffer_delay(bh)) { 1921 1922 lock_buffer(bh); 1922 - mark_buffer_async_write_endio(bh, handler); 1923 + mark_buffer_async_write_endio(bh, 1924 + end_buffer_async_write); 1923 1925 } else { 1924 1926 /* 1925 1927 * The buffer may have been set dirty during ··· 2704 2704 2705 2705 /* Is the folio fully inside i_size? */ 2706 2706 if (folio_pos(folio) + folio_size(folio) <= i_size) 2707 - return __block_write_full_folio(inode, folio, get_block, wbc, 2708 - end_buffer_async_write); 2707 + return __block_write_full_folio(inode, folio, get_block, wbc); 2709 2708 2710 2709 /* Is the folio fully outside i_size? (truncate in progress) */ 2711 2710 if (folio_pos(folio) >= i_size) { ··· 2721 2722 */ 2722 2723 folio_zero_segment(folio, offset_in_folio(folio, i_size), 2723 2724 folio_size(folio)); 2724 - return __block_write_full_folio(inode, folio, get_block, wbc, 2725 - end_buffer_async_write); 2725 + return __block_write_full_folio(inode, folio, get_block, wbc); 2726 2726 } 2727 2727 2728 2728 sector_t generic_block_bmap(struct address_space *mapping, sector_t block,
+1 -1
fs/gfs2/aops.c
··· 108 108 folio_size(folio)); 109 109 110 110 return __block_write_full_folio(inode, folio, gfs2_get_block_noalloc, 111 - wbc, end_buffer_async_write); 111 + wbc); 112 112 } 113 113 114 114 /**
+1 -3
include/linux/buffer_head.h
··· 205 205 unsigned long blocksize, unsigned long b_state); 206 206 void end_buffer_read_sync(struct buffer_head *bh, int uptodate); 207 207 void end_buffer_write_sync(struct buffer_head *bh, int uptodate); 208 - void end_buffer_async_write(struct buffer_head *bh, int uptodate); 209 208 210 209 /* Things to do with buffers at mapping->private_list */ 211 210 void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode); ··· 254 255 int block_write_full_folio(struct folio *folio, struct writeback_control *wbc, 255 256 void *get_block); 256 257 int __block_write_full_folio(struct inode *inode, struct folio *folio, 257 - get_block_t *get_block, struct writeback_control *wbc, 258 - bh_end_io_t *handler); 258 + get_block_t *get_block, struct writeback_control *wbc); 259 259 int block_read_full_folio(struct folio *, get_block_t *); 260 260 bool block_is_partially_uptodate(struct folio *, size_t from, size_t count); 261 261 int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,