Skip to content
Commit 8ca78f3e authored by Jan Schmidt's avatar Jan Schmidt
Browse files

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: default avatarJan Schmidt <list.btrfs@jan-o-sch.net>
parent cb77fcd8
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment