summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/locking.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-22 11:18:09 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commit6dddcbeb28b34620ad033f1e8d9f6960bafdd7d2 (patch)
treef13d7162e219b4028e941cac904999f729e197b2 /fs/btrfs/locking.c
parentf421950f86bf96a11fef932e167ab2e70d4c43a0 (diff)
downloadlinux-stable-6dddcbeb28b34620ad033f1e8d9f6960bafdd7d2.tar.gz
linux-stable-6dddcbeb28b34620ad033f1e8d9f6960bafdd7d2.tar.bz2
linux-stable-6dddcbeb28b34620ad033f1e8d9f6960bafdd7d2.zip
Btrfs: Use mutex_lock_nested for tree locking
Lockdep has the notion of locking subclasses so that you can identify locks you expect to be taken after other locks of the same class. This changes the per-extent buffer btree locking routines to use a subclass based on the level in the tree. Unfortunately, lockdep can only handle 8 total subclasses, and the btrfs max level is also 8. So when lockdep is on, use a lower max level. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/locking.c')
-rw-r--r--fs/btrfs/locking.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index 01a9ac2be3f7..27a02376ab14 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -37,7 +37,7 @@ int btrfs_tree_lock(struct extent_buffer *eb)
return 0;
}
cpu_relax();
- mutex_lock(&eb->mutex);
+ mutex_lock_nested(&eb->mutex, BTRFS_MAX_LEVEL - btrfs_header_level(eb));
return 0;
}