diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-02-12 14:09:45 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-02-12 14:09:45 -0500 |
commit | 4008c04a07c73ec3cb1be4c1391d2159a8f75d6d (patch) | |
tree | c0b10a7287ac810bfc406541e32b850ad4580248 /fs/btrfs/disk-io.h | |
parent | 3f3420df505e47751ef76a652b5cb660e5360d6f (diff) |
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>
Diffstat (limited to 'fs/btrfs/disk-io.h')
-rw-r--r-- | fs/btrfs/disk-io.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.h b/fs/btrfs/disk-io.h index 494a56eb2986..95029db227be 100644 --- a/fs/btrfs/disk-io.h +++ b/fs/btrfs/disk-io.h | |||
@@ -101,4 +101,14 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans, | |||
101 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, | 101 | int btrfs_add_log_tree(struct btrfs_trans_handle *trans, |
102 | struct btrfs_root *root); | 102 | struct btrfs_root *root); |
103 | int btree_lock_page_hook(struct page *page); | 103 | int btree_lock_page_hook(struct page *page); |
104 | |||
105 | |||
106 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
107 | void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level); | ||
108 | #else | ||
109 | static inline void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, | ||
110 | int level) | ||
111 | { | ||
112 | } | ||
113 | #endif | ||
104 | #endif | 114 | #endif |