]> rtime.felk.cvut.cz Git - linux-imx.git/commit
Btrfs: reduce CPU contention while waiting for delayed extent operations
authorChris Mason <chris.mason@fusionio.com>
Tue, 29 Jan 2013 23:44:12 +0000 (18:44 -0500)
committerChris Mason <chris.mason@fusionio.com>
Fri, 1 Feb 2013 19:24:25 +0000 (14:24 -0500)
commitbb721703aa551e98dc5c7fb259cf90343408baf2
tree0f17436d6bb333efe8c12fc4638c398422b2e50b
parent242e18c7c1a8ff3aa05c9fbb6e0bb427511152a6
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>
fs/btrfs/delayed-ref.h
fs/btrfs/extent-tree.c
fs/btrfs/transaction.c