* [PATCH] Btrfs: balance delayed inode updates
@ 2014-02-06 21:07 Josef Bacik
2014-02-06 21:28 ` Josef Bacik
0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2014-02-06 21:07 UTC (permalink / raw)
To: linux-btrfs
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>
---
fs/btrfs/extent-tree.c | 1 +
fs/btrfs/inode.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9c9ecc9..1d9d9ce 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2660,6 +2660,7 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
atomic_read(&trans->transaction->delayed_refs.num_entries);
u64 avg_runtime;
+ return 1;
smp_mb();
avg_runtime = fs_info->avg_delayed_ref_runtime;
if (num_entries * avg_runtime >= NSEC_PER_SEC)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1af34d0..d44ff9f 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,
}
out_unlock:
btrfs_end_transaction(trans, root);
+ btrfs_balance_delayed_items(root);
btrfs_btree_balance_dirty(root);
if (drop_inode) {
inode_dec_link_count(inode);
@@ -5868,6 +5869,7 @@ out_unlock:
inode_dec_link_count(inode);
iput(inode);
}
+ btrfs_balance_delayed_items(root);
btrfs_btree_balance_dirty(root);
return err;
}
@@ -5926,6 +5928,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
}
btrfs_end_transaction(trans, root);
+ btrfs_balance_delayed_items(root);
fail:
if (drop_inode) {
inode_dec_link_count(inode);
@@ -5992,6 +5995,7 @@ out_fail:
btrfs_end_transaction(trans, root);
if (drop_on_err)
iput(inode);
+ btrfs_balance_delayed_items(root);
btrfs_btree_balance_dirty(root);
return err;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: balance delayed inode updates
2014-02-06 21:07 [PATCH] Btrfs: balance delayed inode updates Josef Bacik
@ 2014-02-06 21:28 ` Josef Bacik
0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2014-02-06 21:28 UTC (permalink / raw)
To: linux-btrfs
On 02/06/2014 04:07 PM, Josef Bacik wrote:
> 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>
> ---
> fs/btrfs/extent-tree.c | 1 +
> fs/btrfs/inode.c | 4 ++++
> 2 files changed, 5 insertions(+)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 9c9ecc9..1d9d9ce 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2660,6 +2660,7 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
> atomic_read(&trans->transaction->delayed_refs.num_entries);
> u64 avg_runtime;
>
> + return 1;
> smp_mb();
Do git add for the file I want, do git commit -a anyway.
Josef
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-06 21:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-06 21:07 [PATCH] Btrfs: balance delayed inode updates Josef Bacik
2014-02-06 21:28 ` Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).