Unverified Commit 9f04609f authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Christian Brauner
Browse files

buffer: Convert __block_write_begin() to take a folio



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

Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 7f90d7f1
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);

+1 −1
Original line number Diff line number Diff line
@@ -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)
+3 −3
Original line number Diff line number Diff line
@@ -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);
+4 −4
Original line number Diff line number Diff line
@@ -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))
+1 −1
Original line number Diff line number Diff line
@@ -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)
Loading