From fc28b25e1f428651133326300d9572b42aae6d8f Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 5 Nov 2021 16:45:48 -0400 Subject: btrfs: stop accessing ->csum_root directly We are going to have multiple csum roots in the future, so convert all users of ->csum_root to btrfs_csum_root() and rename ->csum_root to ->_csum_root so we can easily find remaining users in the future. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- fs/btrfs/block-rsv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fs/btrfs/block-rsv.c') diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c index b216c4c7292a..21ac60ec19f6 100644 --- a/fs/btrfs/block-rsv.c +++ b/fs/btrfs/block-rsv.c @@ -353,6 +353,7 @@ void btrfs_update_global_block_rsv(struct btrfs_fs_info *fs_info) struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv; struct btrfs_space_info *sinfo = block_rsv->space_info; struct btrfs_root *extent_root = btrfs_extent_root(fs_info, 0); + struct btrfs_root *csum_root = btrfs_csum_root(fs_info, 0); u64 num_bytes; unsigned min_items; @@ -362,7 +363,7 @@ void btrfs_update_global_block_rsv(struct btrfs_fs_info *fs_info) * it to a minimal amount for safety. */ num_bytes = btrfs_root_used(&extent_root->root_item) + - btrfs_root_used(&fs_info->csum_root->root_item) + + btrfs_root_used(&csum_root->root_item) + btrfs_root_used(&fs_info->tree_root->root_item); /* @@ -476,8 +477,9 @@ static struct btrfs_block_rsv *get_block_rsv( struct btrfs_block_rsv *block_rsv = NULL; if (test_bit(BTRFS_ROOT_SHAREABLE, &root->state) || - (root == fs_info->csum_root && trans->adding_csums) || - (root == fs_info->uuid_root)) + (root == fs_info->uuid_root) || + (trans->adding_csums && + root->root_key.objectid == BTRFS_CSUM_TREE_OBJECTID)) block_rsv = trans->block_rsv; if (!block_rsv) -- cgit v1.2.3-73-gaa49b