@@ -1218,6 +1218,7 @@ struct btrfs_fs_info {
struct btrfs_root *log_root_tree;
struct extent_io_tree extent_cache;
+ struct extent_io_tree dirty_buffers;
struct extent_io_tree free_space_cache;
struct extent_io_tree pinned_extents;
struct extent_io_tree extent_ins;
@@ -867,6 +867,7 @@ struct btrfs_fs_info *btrfs_new_fs_info(int writable, u64 sb_bytenr)
goto free_all;
extent_io_tree_init(&fs_info->extent_cache);
+ extent_io_tree_init(&fs_info->dirty_buffers);
extent_io_tree_init(&fs_info->free_space_cache);
extent_io_tree_init(&fs_info->pinned_extents);
extent_io_tree_init(&fs_info->extent_ins);
@@ -1350,6 +1351,7 @@ void btrfs_cleanup_all_caches(struct btrfs_fs_info *fs_info)
free_extent_buffer(eb);
}
free_mapping_cache_tree(&fs_info->mapping_tree.cache_tree);
+ extent_io_tree_cleanup(&fs_info->dirty_buffers);
extent_io_tree_cleanup(&fs_info->extent_cache);
extent_io_tree_cleanup(&fs_info->free_space_cache);
extent_io_tree_cleanup(&fs_info->pinned_extents);
@@ -1042,7 +1042,7 @@ out:
int set_extent_buffer_dirty(struct extent_buffer *eb)
{
- struct extent_io_tree *tree = &eb->fs_info->extent_cache;
+ struct extent_io_tree *tree = &eb->fs_info->dirty_buffers;
if (!(eb->flags & EXTENT_DIRTY)) {
eb->flags |= EXTENT_DIRTY;
set_extent_dirty(tree, eb->start, eb->start + eb->len - 1);
@@ -1053,7 +1053,7 @@ int set_extent_buffer_dirty(struct extent_buffer *eb)
int clear_extent_buffer_dirty(struct extent_buffer *eb)
{
- struct extent_io_tree *tree = &eb->fs_info->extent_cache;
+ struct extent_io_tree *tree = &eb->fs_info->dirty_buffers;
if (eb->flags & EXTENT_DIRTY) {
eb->flags &= ~EXTENT_DIRTY;
clear_extent_dirty(tree, eb->start, eb->start + eb->len - 1);
@@ -136,7 +136,7 @@ int __commit_transaction(struct btrfs_trans_handle *trans,
u64 end;
struct btrfs_fs_info *fs_info = root->fs_info;
struct extent_buffer *eb;
- struct extent_io_tree *tree = &fs_info->extent_cache;
+ struct extent_io_tree *tree = &fs_info->dirty_buffers;
int ret;
while(1) {
btrfs-progs has a cache tree embedded in the extent_io_tree in order to track extent buffers. We use the extent_io_tree part to track dirty, and the cache tree to keep the extent buffers in. When we sync extent-io-tree.[ch] we'll lose this ability, so separate out the dirty tracking into its own extent_io_tree. Subsequent patches will adjust the extent buffer lookup so it doesn't use the custom extent_io_tree thing. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- kernel-shared/ctree.h | 1 + kernel-shared/disk-io.c | 2 ++ kernel-shared/extent_io.c | 4 ++-- kernel-shared/transaction.c | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-)