diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-01-29 18:44:12 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-01 14:24:25 -0500 |
commit | bb721703aa551e98dc5c7fb259cf90343408baf2 (patch) | |
tree | 0f17436d6bb333efe8c12fc4638c398422b2e50b /fs/btrfs/delayed-ref.h | |
parent | 242e18c7c1a8ff3aa05c9fbb6e0bb427511152a6 (diff) | |
download | op-kernel-dev-bb721703aa551e98dc5c7fb259cf90343408baf2.zip op-kernel-dev-bb721703aa551e98dc5c7fb259cf90343408baf2.tar.gz |
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 c9d7036..23bdeb8 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 |