@@ -2244,7 +2244,14 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node);
extent_io_tree_init(fs_info, &BTRFS_I(inode)->io_tree,
IO_TREE_BTREE_INODE_IO, inode);
- BTRFS_I(inode)->io_tree.track_uptodate = false;
+ /*
+ * For subpage size support, btree inode tracks EXTENT_UPTODATE for
+ * its IO.
+ */
+ if (btrfs_is_subpage(fs_info))
+ BTRFS_I(inode)->io_tree.track_uptodate = true;
+ else
+ BTRFS_I(inode)->io_tree.track_uptodate = false;
extent_map_tree_init(&BTRFS_I(inode)->extent_tree);
BTRFS_I(inode)->io_tree.ops = &btree_extent_io_ops;
Let btree io tree to track EXTENT_UPTODATE bit, so that for subpage metadata IO, we don't need to bother tracking the UPTODATE status manually through bio submission/endio functions. Currently only subpage metadata will cleanup the extra bits utizlied (EXTENT_HAS_TREE_BLOCK, EXTENT_UPTODATE, EXTENT_LOCKED), while the regular page size will only clean up EXTENT_LOCKED. This still allows the regular page size case to avoid the extra delay in extent io tree operations, but allows subpage case to be sector size aligned. Signed-off-by: Qu Wenruo <wqu@suse.com> --- fs/btrfs/disk-io.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)