From: Josef Bacik Date: Tue, 17 Sep 2013 14:50:06 +0000 (-0400) Subject: Btrfs: fix worst case calculator for space usage X-Git-Tag: v3.12-rc2~5^2~11 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=c4fbb4300abd6f662c7d5049d01f868af9874069;p=~emulex%2Finfiniband.git Btrfs: fix worst case calculator for space usage Forever ago I made the worst case calculator say that we could potentially split into 3 blocks for every level on the way down, which isn't right. If we split we're only going to get two new blocks, the one we originally cow'ed and the new one we're going to split. Thanks, Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 2491ba076b4..36490b92ee3 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3135,7 +3135,7 @@ static inline u64 btrfs_calc_trans_metadata_size(struct btrfs_root *root, unsigned num_items) { return (root->leafsize + root->nodesize * (BTRFS_MAX_LEVEL - 1)) * - 3 * num_items; + 2 * num_items; } /*