]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitb7ea8bd7f238e069aea826c82a5731449a34b5df
treed81e13b3388df4a66e3a2af6ff2df82f532d5c9e
parent8b91a4f5a16debd1e9f5821348e50926318f2a0a
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