diff options
Diffstat (limited to 'fs/btrfs/locking.c')
-rw-r--r-- | fs/btrfs/locking.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index d43e14c7471a..0cc314c10d66 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c | |||
@@ -56,3 +56,19 @@ int btrfs_tree_locked(struct extent_buffer *eb) | |||
56 | { | 56 | { |
57 | return mutex_is_locked(&eb->mutex); | 57 | return mutex_is_locked(&eb->mutex); |
58 | } | 58 | } |
59 | |||
60 | int btrfs_path_lock_waiting(struct btrfs_path *path, int level) | ||
61 | { | ||
62 | int i; | ||
63 | struct extent_buffer *eb; | ||
64 | for (i = level; i <= level + 1 && i < BTRFS_MAX_LEVEL; i++) { | ||
65 | eb = path->nodes[i]; | ||
66 | if (!eb) | ||
67 | break; | ||
68 | smp_mb(); | ||
69 | if (!list_empty(&eb->mutex.wait_list)) | ||
70 | return 1; | ||
71 | } | ||
72 | return 0; | ||
73 | } | ||
74 | |||