]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit - fs/btrfs/extent-tree.c
Btrfs: throttle delayed refs better
authorJosef Bacik <jbacik@fb.com>
Thu, 23 Jan 2014 15:54:11 +0000 (10:54 -0500)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:20:26 +0000 (13:20 -0800)
commit0a2b2a844af616addc87cac3cc18dcaba2a9d0fb
treed81e13b3388df4a66e3a2af6ff2df82f532d5c9e
parentd7df2c796d7eedd72a334dc89c65e1fec8171431
Btrfs: throttle delayed refs better

On one of our gluster clusters we noticed some pretty big lag spikes.  This
turned out to be because our transaction commit was taking like 3 minutes to
complete.  This is because we have like 30 gigs of metadata, so our global
reserve would end up being the max which is like 512 mb.  So our throttling code
would allow a ridiculous amount of delayed refs to build up and then they'd all
get run at transaction commit time, and for a cold mounted file system that
could take up to 3 minutes to run.  So fix the throttling to be based on both
the size of the global reserve and how long it takes us to run delayed refs.
This patch tracks the time it takes to run delayed refs and then only allows 1
seconds worth of outstanding delayed refs at a time.  This way it will auto-tune
itself from cold cache up to when everything is in memory and it no longer has
to go to disk.  This makes our transaction commits take much less time to run.
Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/transaction.c