summaryrefslogtreecommitdiff
path: root/fs/btrfs/block-rsv.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@toxicpanda.com>2021-11-05 16:45:48 -0400
committerDavid Sterba <dsterba@suse.com>2022-01-03 15:09:49 +0100
commitfc28b25e1f428651133326300d9572b42aae6d8f (patch)
tree6fa19060d267497123fdcdadafbd9ba62a6c6dc1 /fs/btrfs/block-rsv.c
parent056c83111648a92233f0445bb4a6c1aeafe6be98 (diff)
downloadlwn-fc28b25e1f428651133326300d9572b42aae6d8f.tar.gz
lwn-fc28b25e1f428651133326300d9572b42aae6d8f.zip
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 <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/block-rsv.c')
-rw-r--r--fs/btrfs/block-rsv.c8
1 files changed, 5 insertions, 3 deletions
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)