aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2015-06-09 12:48:21 -0400
committerChris Mason <clm@fb.com>2015-06-10 10:02:46 -0400
commit4617ea3a52cfe8ae407ef406ab999f40a558c369 (patch)
tree12f1391feee7674ed4d411ae71a0bd1c4ffb20c6 /fs/btrfs/ctree.h
parent7558c8bc17481c1f856e009af8503ab40fec348a (diff)
Btrfs: fix necessary chunk tree space calculation when allocating a chunk
When allocating a new chunk or removing one we need to update num_devs device items and insert or remove a chunk item in the chunk tree, so in the worst case the space needed in the chunk space_info is: btrfs_calc_trunc_metadata_size(chunk_root, num_devs) + btrfs_calc_trans_metadata_size(chunk_root, 1) That is, in the worst case we need to cow num_devs paths and cow 1 other path that can result in splitting every node and leaf, and each path consisting of BTRFS_MAX_LEVEL - 1 nodes and 1 leaf. We were requiring some additional chunk_root->nodesize * BTRFS_MAX_LEVEL * num_devs bytes, which were unnecessary since updating the existing device items does not result in splitting the nodes and leaf since after updating them they remain with the same size. Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 92e908394403..5e09834ac2ef 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3518,8 +3518,7 @@ int btrfs_start_write_no_snapshoting(struct btrfs_root *root);
3518void btrfs_end_write_no_snapshoting(struct btrfs_root *root); 3518void btrfs_end_write_no_snapshoting(struct btrfs_root *root);
3519void check_system_chunk(struct btrfs_trans_handle *trans, 3519void check_system_chunk(struct btrfs_trans_handle *trans,
3520 struct btrfs_root *root, 3520 struct btrfs_root *root,
3521 const u64 type, 3521 const u64 type);
3522 const bool is_allocation);
3523/* ctree.c */ 3522/* ctree.c */
3524int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, 3523int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key,
3525 int level, int *slot); 3524 int level, int *slot);