diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-01-30 00:44:12 +0100 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-01 20:24:25 +0100 |
commit | bb721703aa551e98dc5c7fb259cf90343408baf2 (patch) | |
tree | 0f17436d6bb333efe8c12fc4638c398422b2e50b /fs/btrfs/delayed-ref.h | |
parent | Btrfs: reduce lock contention on extent buffer locks (diff) | |
download | linux-bb721703aa551e98dc5c7fb259cf90343408baf2.tar.xz linux-bb721703aa551e98dc5c7fb259cf90343408baf2.zip |
Btrfs: reduce CPU contention while waiting for delayed extent operations
We batch up operations to the extent allocation tree, which allows
us to deal with the recursive nature of using the extent allocation
tree to allocate extents to the extent allocation tree.
It also provides a mechanism to sort and collect extent
operations, which makes it much more efficient to record extents
that are close together.
The delayed extent operations must all be finished before the
running transaction commits, so we have code to make sure and run a few
of the batched operations when closing our transaction handles.
This creates a great deal of contention for the locks in the
delayed extent operation tree, and also contention for the lock on the
extent allocation tree itself. All the extra contention just slows
down the operations and doesn't get things done any faster.
This commit changes things to use a wait queue instead. As procs
want to run the delayed operations, one of them races in and gets
permission to hit the tree, and the others step back and wait for
progress to be made.
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/delayed-ref.h')
-rw-r--r-- | fs/btrfs/delayed-ref.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h index c9d703693df0..23bdeb8502a6 100644 --- a/fs/btrfs/delayed-ref.h +++ b/fs/btrfs/delayed-ref.h @@ -132,6 +132,15 @@ struct btrfs_delayed_ref_root { unsigned long num_heads_ready; /* + * bumped when someone is making progress on the delayed + * refs, so that other procs know they are just adding to + * contention intead of helping + */ + atomic_t procs_running_refs; + atomic_t ref_seq; + wait_queue_head_t wait; + + /* * set when the tree is flushing before a transaction commit, * used by the throttling code to decide if new updates need * to be run right away |