aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-03-26 15:26:55 -0400
committerJosef Bacik <jbacik@fusionio.com>2013-03-28 09:51:27 -0400
commit6e137ed3f30574f314733d4b7a86ea6523232b14 (patch)
treeb3ecd59c91104f4f236a92dbe98236d42dc70ce2 /fs
parentf4881bc7a83eff263789dd524b7c269d138d4af5 (diff)
Btrfs: fix space accounting for unlink and rename
We are way over-reserving for unlink and rename. Rename is just some random huge number and unlink accounts for tree log operations that don't actually happen during unlink, not to mention the tree log doesn't take from the trans block rsv anyway so it's completely useless. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6a6e13c53086..8cab424c75f8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3693,11 +3693,9 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir,
3693 * 1 for the dir item 3693 * 1 for the dir item
3694 * 1 for the dir index 3694 * 1 for the dir index
3695 * 1 for the inode ref 3695 * 1 for the inode ref
3696 * 1 for the inode ref in the tree log
3697 * 2 for the dir entries in the log
3698 * 1 for the inode 3696 * 1 for the inode
3699 */ 3697 */
3700 trans = btrfs_start_transaction(root, 8); 3698 trans = btrfs_start_transaction(root, 5);
3701 if (!IS_ERR(trans) || PTR_ERR(trans) != -ENOSPC) 3699 if (!IS_ERR(trans) || PTR_ERR(trans) != -ENOSPC)
3702 return trans; 3700 return trans;
3703 3701
@@ -8141,7 +8139,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
8141 * inodes. So 5 * 2 is 10, plus 1 for the new link, so 11 total items 8139 * inodes. So 5 * 2 is 10, plus 1 for the new link, so 11 total items
8142 * should cover the worst case number of items we'll modify. 8140 * should cover the worst case number of items we'll modify.
8143 */ 8141 */
8144 trans = btrfs_start_transaction(root, 20); 8142 trans = btrfs_start_transaction(root, 11);
8145 if (IS_ERR(trans)) { 8143 if (IS_ERR(trans)) {
8146 ret = PTR_ERR(trans); 8144 ret = PTR_ERR(trans);
8147 goto out_notrans; 8145 goto out_notrans;