All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-block@vger.kernel.org
Subject: [PATCH 14/14] fs: Remove the bh_end_io argument from __block_write_full_folio
Date: Fri, 15 Dec 2023 20:02:45 +0000	[thread overview]
Message-ID: <20231215200245.748418-15-willy@infradead.org> (raw)
In-Reply-To: <20231215200245.748418-1-willy@infradead.org>

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.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/buffer.c                 | 22 ++++++++++------------
 fs/gfs2/aops.c              |  2 +-
 include/linux/buffer_head.h |  4 +---
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 2e69f0ddca37..d5ce6b29c893 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -372,10 +372,10 @@ static void end_buffer_async_read_io(struct buffer_head *bh, int uptodate)
 }
 
 /*
- * Completion handler for block_write_full_folio() - pages which are unlocked
- * during I/O, and which have PageWriteback cleared upon I/O completion.
+ * Completion handler for block_write_full_folio() - folios which are unlocked
+ * during I/O, and which have the writeback flag cleared upon I/O completion.
  */
-void end_buffer_async_write(struct buffer_head *bh, int uptodate)
+static void end_buffer_async_write(struct buffer_head *bh, int uptodate)
 {
 	unsigned long flags;
 	struct buffer_head *first;
@@ -415,7 +415,6 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate)
 	spin_unlock_irqrestore(&first->b_uptodate_lock, flags);
 	return;
 }
-EXPORT_SYMBOL(end_buffer_async_write);
 
 /*
  * If a page's buffers are under async readin (end_buffer_async_read
@@ -1787,8 +1786,7 @@ static struct buffer_head *folio_create_buffers(struct folio *folio,
  * causes the writes to be flagged as synchronous writes.
  */
 int __block_write_full_folio(struct inode *inode, struct folio *folio,
-			get_block_t *get_block, struct writeback_control *wbc,
-			bh_end_io_t *handler)
+			get_block_t *get_block, struct writeback_control *wbc)
 {
 	int err;
 	sector_t block;
@@ -1867,7 +1865,8 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio,
 			continue;
 		}
 		if (test_clear_buffer_dirty(bh)) {
-			mark_buffer_async_write_endio(bh, handler);
+			mark_buffer_async_write_endio(bh,
+				end_buffer_async_write);
 		} else {
 			unlock_buffer(bh);
 		}
@@ -1920,7 +1919,8 @@ int __block_write_full_folio(struct inode *inode, struct folio *folio,
 		if (buffer_mapped(bh) && buffer_dirty(bh) &&
 		    !buffer_delay(bh)) {
 			lock_buffer(bh);
-			mark_buffer_async_write_endio(bh, handler);
+			mark_buffer_async_write_endio(bh,
+				end_buffer_async_write);
 		} else {
 			/*
 			 * The buffer may have been set dirty during
@@ -2704,8 +2704,7 @@ int block_write_full_folio(struct folio *folio, struct writeback_control *wbc,
 
 	/* Is the folio fully inside i_size? */
 	if (folio_pos(folio) + folio_size(folio) <= i_size)
-		return __block_write_full_folio(inode, folio, get_block, wbc,
-					       end_buffer_async_write);
+		return __block_write_full_folio(inode, folio, get_block, wbc);
 
 	/* Is the folio fully outside i_size? (truncate in progress) */
 	if (folio_pos(folio) >= i_size) {
@@ -2722,8 +2721,7 @@ int block_write_full_folio(struct folio *folio, struct writeback_control *wbc,
 	 */
 	folio_zero_segment(folio, offset_in_folio(folio, i_size),
 			folio_size(folio));
-	return __block_write_full_folio(inode, folio, get_block, wbc,
-			end_buffer_async_write);
+	return __block_write_full_folio(inode, folio, get_block, wbc);
 }
 
 sector_t generic_block_bmap(struct address_space *mapping, sector_t block,
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index f986cd032b76..9914d7f54f7d 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -108,7 +108,7 @@ static int gfs2_write_jdata_folio(struct folio *folio,
 				folio_size(folio));
 
 	return __block_write_full_folio(inode, folio, gfs2_get_block_noalloc,
-			wbc, end_buffer_async_write);
+			wbc);
 }
 
 /**
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 396b2adf24bf..d78454a4dd1f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -205,7 +205,6 @@ struct buffer_head *create_empty_buffers(struct folio *folio,
 		unsigned long blocksize, unsigned long b_state);
 void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
 void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
-void end_buffer_async_write(struct buffer_head *bh, int uptodate);
 
 /* Things to do with buffers at mapping->private_list */
 void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
@@ -255,8 +254,7 @@ void block_invalidate_folio(struct folio *folio, size_t offset, size_t length);
 int block_write_full_folio(struct folio *folio, struct writeback_control *wbc,
 		void *get_block);
 int __block_write_full_folio(struct inode *inode, struct folio *folio,
-			get_block_t *get_block, struct writeback_control *wbc,
-			bh_end_io_t *handler);
+		get_block_t *get_block, struct writeback_control *wbc);
 int block_read_full_folio(struct folio *, get_block_t *);
 bool block_is_partially_uptodate(struct folio *, size_t from, size_t count);
 int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
-- 
2.42.0


  parent reply	other threads:[~2023-12-15 20:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 20:02 [PATCH 00/14] Clean up the writeback paths Matthew Wilcox (Oracle)
2023-12-15 20:02 ` [PATCH 01/14] fs: Remove clean_page_buffers() Matthew Wilcox (Oracle)
2023-12-16  4:27   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 02/14] fs: Convert clean_buffers() to take a folio Matthew Wilcox (Oracle)
2023-12-16  4:27   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 03/14] fs: Reduce stack usage in __mpage_writepage Matthew Wilcox (Oracle)
2023-12-16  4:29   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 04/14] fs: Reduce stack usage in do_mpage_readpage Matthew Wilcox (Oracle)
2023-12-16  4:29   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 05/14] adfs: Remove writepage implementation Matthew Wilcox (Oracle)
2023-12-16  4:31   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 06/14] bfs: " Matthew Wilcox (Oracle)
2023-12-17 16:48   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 07/14] hfs: Really remove hfs_writepage Matthew Wilcox (Oracle)
2023-12-18  4:31   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 08/14] hfsplus: Really remove hfsplus_writepage Matthew Wilcox (Oracle)
2023-12-16  4:33   ` Christoph Hellwig
2023-12-18 10:41     ` Johannes Thumshirn
2023-12-18 15:04       ` Christoph Hellwig
2023-12-18 15:40         ` Johannes Thumshirn
2024-01-04 17:25           ` Jan Kara
2023-12-15 20:02 ` [PATCH 09/14] minix: Remove writepage implementation Matthew Wilcox (Oracle)
2023-12-17 16:48   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 10/14] ocfs2: " Matthew Wilcox (Oracle)
2023-12-16  4:34   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 11/14] sysv: " Matthew Wilcox (Oracle)
2023-12-17 16:48   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 12/14] ufs: " Matthew Wilcox (Oracle)
2023-12-16  4:34   ` Christoph Hellwig
2023-12-15 20:02 ` [PATCH 13/14] fs: Convert block_write_full_page to block_write_full_folio Matthew Wilcox (Oracle)
2023-12-16  4:35   ` Christoph Hellwig
2023-12-15 20:02 ` Matthew Wilcox (Oracle) [this message]
2023-12-20  6:36   ` [PATCH 14/14] fs: Remove the bh_end_io argument from __block_write_full_folio Christoph Hellwig
2023-12-16 20:51 ` [PATCH 00/14] Clean up the writeback paths Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231215200245.748418-15-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.