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)
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>

No differences found