]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
Btrfs: avoid waiting for delayed refs when we must not
authorJan Schmidt <list.btrfs@jan-o-sch.net>
Wed, 27 Jun 2012 13:05:48 +0000 (15:05 +0200)
committerJan Schmidt <list.btrfs@jan-o-sch.net>
Wed, 27 Jun 2012 14:34:35 +0000 (16:34 +0200)
commit8ca78f3eda4bf1799e8c4ba02035623fd7a347df
tree7d4ae8520273276213d1e02921b3eb338fc6a6f4
parentcb77fcd88569cd2b7b25ecd4086ea932a53be9b3
Btrfs: avoid waiting for delayed refs when we must not

We track two conditions to decide if we should sleep while waiting for more
delayed refs, the number of delayed refs (num_refs) and the first entry in
the list of blockers (first_seq).

When we suspect staleness, we save num_refs and do one more cycle. If
nothing changes, we then save first_seq for later comparison and do
wait_event. We ought to save first_seq the very same moment we're saving
num_refs. Otherwise we cannot be sure that nothing has changed and we might
start waiting when we shouldn't, which could lead to starvation.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
fs/btrfs/extent-tree.c