linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH 23/23] buffer: Convert __block_write_begin() to take a folio
Date: Wed, 17 Jul 2024 16:47:13 +0100	[thread overview]
Message-ID: <20240717154716.237943-24-willy@infradead.org> (raw)
In-Reply-To: <20240717154716.237943-1-willy@infradead.org>

Almost all callers have a folio now, so change __block_write_begin()
to take a folio and remove a call to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/buffer.c                 | 5 ++---
 fs/ext2/dir.c               | 2 +-
 fs/ext4/inline.c            | 6 +++---
 fs/ext4/inode.c             | 8 ++++----
 fs/minix/inode.c            | 2 +-
 fs/nilfs2/dir.c             | 2 +-
 fs/ocfs2/file.c             | 2 +-
 fs/reiserfs/inode.c         | 6 +++---
 fs/sysv/itree.c             | 2 +-
 fs/udf/file.c               | 2 +-
 fs/ufs/inode.c              | 2 +-
 include/linux/buffer_head.h | 2 +-
 12 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index d52a740f7fca..45eb06cb1a4e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2168,11 +2168,10 @@ int __block_write_begin_int(struct folio *folio, loff_t pos, unsigned len,
 	return err;
 }
 
-int __block_write_begin(struct page *page, loff_t pos, unsigned len,
+int __block_write_begin(struct folio *folio, loff_t pos, unsigned len,
 		get_block_t *get_block)
 {
-	return __block_write_begin_int(page_folio(page), pos, len, get_block,
-				       NULL);
+	return __block_write_begin_int(folio, pos, len, get_block, NULL);
 }
 EXPORT_SYMBOL(__block_write_begin);
 
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 60605fbdd0eb..2f3042d0174c 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -434,7 +434,7 @@ int ext2_inode_by_name(struct inode *dir, const struct qstr *child, ino_t *ino)
 
 static int ext2_prepare_chunk(struct folio *folio, loff_t pos, unsigned len)
 {
-	return __block_write_begin(&folio->page, pos, len, ext2_get_block);
+	return __block_write_begin(folio, pos, len, ext2_get_block);
 }
 
 static int ext2_handle_dirsync(struct inode *dir)
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index b7ea9cb4c398..d5c2f3b75084 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -601,10 +601,10 @@ static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
 		goto out;
 
 	if (ext4_should_dioread_nolock(inode)) {
-		ret = __block_write_begin(&folio->page, from, to,
+		ret = __block_write_begin(folio, from, to,
 					  ext4_get_block_unwritten);
 	} else
-		ret = __block_write_begin(&folio->page, from, to, ext4_get_block);
+		ret = __block_write_begin(folio, from, to, ext4_get_block);
 
 	if (!ret && ext4_should_journal_data(inode)) {
 		ret = ext4_walk_page_buffers(handle, inode,
@@ -856,7 +856,7 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping,
 			goto out;
 	}
 
-	ret = __block_write_begin(&folio->page, 0, inline_size,
+	ret = __block_write_begin(folio, 0, inline_size,
 				  ext4_da_get_block_prep);
 	if (ret) {
 		up_read(&EXT4_I(inode)->xattr_sem);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 90ef8ec5c59b..03374dc215d1 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1224,10 +1224,10 @@ static int ext4_write_begin(struct file *file, struct address_space *mapping,
 		ret = ext4_block_write_begin(folio, pos, len, ext4_get_block);
 #else
 	if (ext4_should_dioread_nolock(inode))
-		ret = __block_write_begin(&folio->page, pos, len,
+		ret = __block_write_begin(folio, pos, len,
 					  ext4_get_block_unwritten);
 	else
-		ret = __block_write_begin(&folio->page, pos, len, ext4_get_block);
+		ret = __block_write_begin(folio, pos, len, ext4_get_block);
 #endif
 	if (!ret && ext4_should_journal_data(inode)) {
 		ret = ext4_walk_page_buffers(handle, inode,
@@ -2962,7 +2962,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
 #ifdef CONFIG_FS_ENCRYPTION
 	ret = ext4_block_write_begin(folio, pos, len, ext4_da_get_block_prep);
 #else
-	ret = __block_write_begin(&folio->page, pos, len, ext4_da_get_block_prep);
+	ret = __block_write_begin(folio, pos, len, ext4_da_get_block_prep);
 #endif
 	if (ret < 0) {
 		folio_unlock(folio);
@@ -6216,7 +6216,7 @@ vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf)
 		if (folio_pos(folio) + len > size)
 			len = size - folio_pos(folio);
 
-		err = __block_write_begin(&folio->page, 0, len, ext4_get_block);
+		err = __block_write_begin(folio, 0, len, ext4_get_block);
 		if (!err) {
 			ret = VM_FAULT_SIGBUS;
 			if (ext4_journal_folio_buffers(handle, folio, len))
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index abb190c46c04..f007e389d5d2 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -429,7 +429,7 @@ static int minix_read_folio(struct file *file, struct folio *folio)
 
 int minix_prepare_chunk(struct folio *folio, loff_t pos, unsigned len)
 {
-	return __block_write_begin(&folio->page, pos, len, minix_get_block);
+	return __block_write_begin(folio, pos, len, minix_get_block);
 }
 
 static void minix_write_failed(struct address_space *mapping, loff_t to)
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index 66af42f88ca7..4b3e19d74925 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -83,7 +83,7 @@ static int nilfs_prepare_chunk(struct folio *folio, unsigned int from,
 {
 	loff_t pos = folio_pos(folio) + from;
 
-	return __block_write_begin(&folio->page, pos, to - from, nilfs_get_block);
+	return __block_write_begin(folio, pos, to - from, nilfs_get_block);
 }
 
 static void nilfs_commit_chunk(struct folio *folio,
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index cfec1782ac2a..d058eb30cfc2 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -804,7 +804,7 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from,
 		 * __block_write_begin and block_commit_write to zero the
 		 * whole block.
 		 */
-		ret = __block_write_begin(&folio->page, block_start + 1, 0,
+		ret = __block_write_begin(folio, block_start + 1, 0,
 					  ocfs2_get_block);
 		if (ret < 0) {
 			mlog_errno(ret);
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index ea23872ba24f..72c53129c952 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2198,7 +2198,7 @@ static int grab_tail_page(struct inode *inode,
 	/* start within the page of the last block in the file */
 	start = (offset / blocksize) * blocksize;
 
-	error = __block_write_begin(&folio->page, start, offset - start,
+	error = __block_write_begin(folio, start, offset - start,
 				    reiserfs_get_block_create_0);
 	if (error)
 		goto unlock;
@@ -2762,7 +2762,7 @@ static int reiserfs_write_begin(struct file *file,
 		old_ref = th->t_refcount;
 		th->t_refcount++;
 	}
-	ret = __block_write_begin(&folio->page, pos, len, reiserfs_get_block);
+	ret = __block_write_begin(folio, pos, len, reiserfs_get_block);
 	if (ret && reiserfs_transaction_running(inode->i_sb)) {
 		struct reiserfs_transaction_handle *th = current->journal_info;
 		/*
@@ -2822,7 +2822,7 @@ int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len)
 		th->t_refcount++;
 	}
 
-	ret = __block_write_begin(page, from, len, reiserfs_get_block);
+	ret = __block_write_begin(page_folio(page), from, len, reiserfs_get_block);
 	if (ret && reiserfs_transaction_running(inode->i_sb)) {
 		struct reiserfs_transaction_handle *th = current->journal_info;
 		/*
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c
index 8864438817a6..451e95f474fa 100644
--- a/fs/sysv/itree.c
+++ b/fs/sysv/itree.c
@@ -468,7 +468,7 @@ static int sysv_read_folio(struct file *file, struct folio *folio)
 
 int sysv_prepare_chunk(struct folio *folio, loff_t pos, unsigned len)
 {
-	return __block_write_begin(&folio->page, pos, len, get_block);
+	return __block_write_begin(folio, pos, len, get_block);
 }
 
 static void sysv_write_failed(struct address_space *mapping, loff_t to)
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 3a4179de316b..412fe7c4d348 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -62,7 +62,7 @@ static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf)
 		end = size & ~PAGE_MASK;
 	else
 		end = PAGE_SIZE;
-	err = __block_write_begin(&folio->page, 0, end, udf_get_block);
+	err = __block_write_begin(folio, 0, end, udf_get_block);
 	if (err) {
 		folio_unlock(folio);
 		ret = vmf_fs_error(err);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index f43461652d9f..5331ae7ebf3e 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -481,7 +481,7 @@ static int ufs_read_folio(struct file *file, struct folio *folio)
 
 int ufs_prepare_chunk(struct folio *folio, loff_t pos, unsigned len)
 {
-	return __block_write_begin(&folio->page, pos, len, ufs_getfrag_block);
+	return __block_write_begin(folio, pos, len, ufs_getfrag_block);
 }
 
 static void ufs_truncate_blocks(struct inode *);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 254563a2a9de..c85e65fd4cdc 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -259,7 +259,7 @@ 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,
 		struct folio **foliop, get_block_t *get_block);
-int __block_write_begin(struct page *page, loff_t pos, unsigned len,
+int __block_write_begin(struct folio *folio, loff_t pos, unsigned len,
 		get_block_t *get_block);
 int block_write_end(struct file *, struct address_space *,
 				loff_t, unsigned len, unsigned copied,
-- 
2.43.0


  parent reply	other threads:[~2024-07-17 15:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 15:46 [PATCH 00/23] Convert write_begin / write_end to take a folio Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 01/23] reiserfs: Convert grab_tail_page() to use " Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 02/23] reiserfs: Convert reiserfs_write_begin() " Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 03/23] block: Use a folio in blkdev_write_end() Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 04/23] buffer: Use a folio in generic_write_end() Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 05/23] nilfs2: Use a folio in nilfs_recover_dsync_blocks() Matthew Wilcox (Oracle)
2024-07-18 17:14   ` Ryusuke Konishi
2024-07-17 15:46 ` [PATCH 06/23] ntfs3: Remove reset_log_file() Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 07/23] buffer: Convert block_write_end() to take a folio Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 08/23] ecryptfs: Convert ecryptfs_write_end() to use " Matthew Wilcox (Oracle)
2024-07-17 15:46 ` [PATCH 09/23] ecryptfs: Use a folio in ecryptfs_write_begin() Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 10/23] f2fs: Convert f2fs_write_end() to use a folio Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 11/23] f2fs: Convert f2fs_write_begin() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 12/23] fuse: Convert fuse_write_end() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 13/23] fuse: Convert fuse_write_begin() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 14/23] hostfs: Convert hostfs_write_end() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 15/23] jffs2: Convert jffs2_write_end() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 16/23] jffs2: Convert jffs2_write_begin() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 17/23] orangefs: Convert orangefs_write_end() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 18/23] orangefs: Convert orangefs_write_begin() " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 19/23] vboxsf: Use a folio in vboxsf_write_end() Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 20/23] fs: Convert aops->write_end to take a folio Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 21/23] fs: Convert aops->write_begin " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` [PATCH 22/23] ocfs2: Convert ocfs2_write_zero_page to use " Matthew Wilcox (Oracle)
2024-07-17 15:47 ` Matthew Wilcox (Oracle) [this message]
2024-07-18 15:24 ` [PATCH 00/23] Convert write_begin / write_end to take " Josef Bacik
2024-07-23  7:49 ` Christian Brauner
2024-07-23 13:20   ` Matthew Wilcox
2024-07-23 13:41     ` Christian Brauner
2024-07-23 22:54       ` Matthew Wilcox
2024-07-30 14:23         ` Christian Brauner

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=20240717154716.237943-24-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=linux-fsdevel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).