Skip to content

Throttle delayed refs based on time

Josef Bacik linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13btrfs: use a stable rolling avg for delayed refs avgfs/btrfs/ctree.h fs/btrfs/disk-io.c fs/btrfs/extent-tree.c+27 -20 replies
2/13btrfs: change btrfs_should_throttle_delayed_refs to a boolfs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h+4 -40 replies
3/13btrfs: make btrfs_should_throttle_delayed_refs only check run timefs/btrfs/delayed-ref.c fs/btrfs/inode.c+3 -30 replies
4/13btrfs: make should_end_transaction check time to run delayed refsfs/btrfs/transaction.c+2 -10 replies
5/13btrfs: squash should_end_transactionfs/btrfs/transaction.c+6 -120 replies
6/13btrfs: add a mode for delayed ref time based throttlingfs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h fs/btrfs/inode.c +1 more+10 -70 replies
7/13btrfs: kick off async delayed ref flushing if we are over time budgetfs/btrfs/ctree.h fs/btrfs/disk-io.c fs/btrfs/extent-tree.c +1 more+59 -02 replies
8/13btrfs: adjust the arguments for btrfs_should_throttle_delayed_refsfs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h fs/btrfs/extent-tree.c +2 more+13 -100 replies
9/13btrfs: throttle delayed refs based on timefs/btrfs/delayed-ref.c fs/btrfs/delayed-ref.h fs/btrfs/extent-tree.c +2 more+83 -60 replies
10/13btrfs: handle uncontrolled delayed ref generationfs/btrfs/delayed-ref.h fs/btrfs/transaction.c+24 -00 replies
11/13btrfs: check delayed refs while relocatingfs/btrfs/relocation.c+10 -00 replies
12/13btrfs: throttle truncate for delayed ref generationfs/btrfs/inode.c+15 -00 replies
13/13btrfs: throttle snapshot delete on delayed refsfs/btrfs/extent-tree.c+30 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/13] Throttle delayed refs based on time

Zygo reported a problem on IRC where he was seeing multi-hour long latencies with his test rig with transaction commits. This turned out to be because his test rig runs rsync, balance, snapshot create and delete, dedup, a infinite loop of mkdir/rmdirs, and I'm sure some other horrors I'm forgetting.

When I added the delayed refs reserve, I assumed that the space pressure generated by generating a lot of delayed refs would result in transactions being ended if they needed to be, and thus we no longer needed to throttle delayed refs based on time.

This assumption was wrong, because in Zygo's case he has a multi terabyte file system, so overcommit allows him to generate as many delayed refs as he wants. This meant that he would need to run hundreds of thousands of delayed refs at commit time. To make matters worse, we didn't have a way to stop people from generating more delayed refs, so the transaction commit could be held open indefinitely by balance and snapshot delete. This is how we were getting transaction commits happening every few hours.

The solution to this problem is to bring back the time based delayed ref flushing, and then add the ability for people to throttle themselves on that.

Balance and truncate already had this ability, it only needed to be added to snapshot delete.

I've also added back the async delayed ref flushing, and I've added code to help throttle people when we're generating delayed refs too fast for the system to keep up with them.

This whole patch queue has been running in some form or another on Zygo's awful test bed, and appears to be performing better than it was before I ripped out the original code. Thanks,

Josef