Commit c86d3aac authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba
Browse files

btrfs: convert insert_inline_extent() to use a folio



We only use a page to copy in the data for the inline extent.  Use a
folio for this instead.

Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1bbf3a3a
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -495,7 +495,6 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
{
	struct btrfs_root *root = inode->root;
	struct extent_buffer *leaf;
	struct page *page = NULL;
	const u32 sectorsize = trans->fs_info->sectorsize;
	char *kaddr;
	unsigned long ptr;
@@ -555,12 +554,16 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
		btrfs_set_file_extent_compression(leaf, ei,
						  compress_type);
	} else {
		page = find_get_page(inode->vfs_inode.i_mapping, 0);
		struct folio *folio;

		folio = __filemap_get_folio(inode->vfs_inode.i_mapping,
					    0, 0, 0);
		ASSERT(!IS_ERR(folio));
		btrfs_set_file_extent_compression(leaf, ei, 0);
		kaddr = kmap_local_page(page);
		kaddr = kmap_local_folio(folio, 0);
		write_extent_buffer(leaf, kaddr, ptr, size);
		kunmap_local(kaddr);
		put_page(page);
		folio_put(folio);
	}
	btrfs_mark_buffer_dirty(trans, leaf);
	btrfs_release_path(path);