]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: make a lockdep class for the extent buffer locks
authorChris Mason <chris.mason@oracle.com>
Thu, 12 Feb 2009 19:09:45 +0000 (14:09 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 12 Feb 2009 19:09:45 +0000 (14:09 -0500)
commit8de5b8468647b57e553eeff7139f967b4f8ad2e8
treec0b10a7287ac810bfc406541e32b850ad4580248
parent9244b4593ac6180ab8e055c0e03e1c0507dc7375
Btrfs: make a lockdep class for the extent buffer locks

Btrfs is currently using spin_lock_nested with a nested value based
on the tree depth of the block.  But, this doesn't quite work because
the max tree depth is bigger than what spin_lock_nested can deal with,
and because locks are sometimes taken before the level field is filled in.

The solution here is to use lockdep_set_class_and_name instead, and to
set the class before unlocking the pages when the block is read from the
disk and just after init of a freshly allocated tree block.

btrfs_clear_path_blocking is also changed to take the locks in the proper
order, and it also makes sure all the locks currently held are properly
set to blocking before it tries to retake the spinlocks.  Otherwise, lockdep
gets upset about bad lock orderin.

The lockdep magic cam from Peter Zijlstra <peterz@infradead.org>

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent-tree.c
fs/btrfs/locking.c
fs/btrfs/volumes.c