diff options
author | Josef Bacik <jbacik@fb.com> | 2014-02-06 16:06:06 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2014-03-10 15:15:52 -0400 |
commit | c581afc8db4e9aaa8af2246bb72c1bf72825014d (patch) | |
tree | 2f1f68385417065407d6c17fc348866f5142bf7c /fs/btrfs/inode.c | |
parent | 1bae30982bc86ab66d61ccb6e22792593b45d44d (diff) |
Btrfs: balance delayed inode updates
While trying to reproduce a delayed ref problem I noticed the box kept falling
over using all 80gb of my ram with btrfs_inode's and btrfs_delayed_node's.
Turns out this is because we only throttle delayed inode updates in
btrfs_dirty_inode, which doesn't actually get called that often, especially when
all you are doing is creating a bunch of files. So balance delayed inode
updates everytime we create a new inode. With this patch we no longer use up
all of our ram with delayed inode updates. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4ffb6d79f9f0..a7e6690e0946 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -5795,6 +5795,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | |||
5795 | } | 5795 | } |
5796 | out_unlock: | 5796 | out_unlock: |
5797 | btrfs_end_transaction(trans, root); | 5797 | btrfs_end_transaction(trans, root); |
5798 | btrfs_balance_delayed_items(root); | ||
5798 | btrfs_btree_balance_dirty(root); | 5799 | btrfs_btree_balance_dirty(root); |
5799 | if (drop_inode) { | 5800 | if (drop_inode) { |
5800 | inode_dec_link_count(inode); | 5801 | inode_dec_link_count(inode); |
@@ -5868,6 +5869,7 @@ out_unlock: | |||
5868 | inode_dec_link_count(inode); | 5869 | inode_dec_link_count(inode); |
5869 | iput(inode); | 5870 | iput(inode); |
5870 | } | 5871 | } |
5872 | btrfs_balance_delayed_items(root); | ||
5871 | btrfs_btree_balance_dirty(root); | 5873 | btrfs_btree_balance_dirty(root); |
5872 | return err; | 5874 | return err; |
5873 | } | 5875 | } |
@@ -5926,6 +5928,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
5926 | } | 5928 | } |
5927 | 5929 | ||
5928 | btrfs_end_transaction(trans, root); | 5930 | btrfs_end_transaction(trans, root); |
5931 | btrfs_balance_delayed_items(root); | ||
5929 | fail: | 5932 | fail: |
5930 | if (drop_inode) { | 5933 | if (drop_inode) { |
5931 | inode_dec_link_count(inode); | 5934 | inode_dec_link_count(inode); |
@@ -5992,6 +5995,7 @@ out_fail: | |||
5992 | btrfs_end_transaction(trans, root); | 5995 | btrfs_end_transaction(trans, root); |
5993 | if (drop_on_err) | 5996 | if (drop_on_err) |
5994 | iput(inode); | 5997 | iput(inode); |
5998 | btrfs_balance_delayed_items(root); | ||
5995 | btrfs_btree_balance_dirty(root); | 5999 | btrfs_btree_balance_dirty(root); |
5996 | return err; | 6000 | return err; |
5997 | } | 6001 | } |