Lines Matching +full:1 +full:eb

19  * eb, the lockdep key is determined by the btrfs_root it belongs to and
20 * the level the eb occupies in the tree.
50 DEFINE_LEVEL(stem, 1) \
82 void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb, int level) in btrfs_set_buffer_lockdep_class() argument
93 lockdep_set_class_and_name(&eb->lock, &ks->keys[level], ks->names[level]); in btrfs_set_buffer_lockdep_class()
96 void btrfs_maybe_reset_lockdep_class(struct btrfs_root *root, struct extent_buffer *eb) in btrfs_maybe_reset_lockdep_class() argument
100 eb, btrfs_header_level(eb)); in btrfs_maybe_reset_lockdep_class()
123 * @eb: the eb to be locked
129 void __btrfs_tree_read_lock(struct extent_buffer *eb, enum btrfs_lock_nesting nest) in __btrfs_tree_read_lock() argument
136 down_read_nested(&eb->lock, nest); in __btrfs_tree_read_lock()
137 trace_btrfs_tree_read_lock(eb, start_ns); in __btrfs_tree_read_lock()
140 void btrfs_tree_read_lock(struct extent_buffer *eb) in btrfs_tree_read_lock() argument
142 __btrfs_tree_read_lock(eb, BTRFS_NESTING_NORMAL); in btrfs_tree_read_lock()
148 * Return 1 if the rwlock has been taken, 0 otherwise
150 int btrfs_try_tree_read_lock(struct extent_buffer *eb) in btrfs_try_tree_read_lock() argument
152 if (down_read_trylock(&eb->lock)) { in btrfs_try_tree_read_lock()
153 trace_btrfs_try_tree_read_lock(eb); in btrfs_try_tree_read_lock()
154 return 1; in btrfs_try_tree_read_lock()
162 * Return 1 if the rwlock has been taken, 0 otherwise
164 int btrfs_try_tree_write_lock(struct extent_buffer *eb) in btrfs_try_tree_write_lock() argument
166 if (down_write_trylock(&eb->lock)) { in btrfs_try_tree_write_lock()
167 eb->lock_owner = current->pid; in btrfs_try_tree_write_lock()
168 trace_btrfs_try_tree_write_lock(eb); in btrfs_try_tree_write_lock()
169 return 1; in btrfs_try_tree_write_lock()
177 void btrfs_tree_read_unlock(struct extent_buffer *eb) in btrfs_tree_read_unlock() argument
179 trace_btrfs_tree_read_unlock(eb); in btrfs_tree_read_unlock()
180 up_read(&eb->lock); in btrfs_tree_read_unlock()
184 * __btrfs_tree_lock - lock eb for write
185 * @eb: the eb to lock
188 * Returns with the eb->lock write locked.
190 void __btrfs_tree_lock(struct extent_buffer *eb, enum btrfs_lock_nesting nest) in __btrfs_tree_lock() argument
191 __acquires(&eb->lock) in __btrfs_tree_lock()
198 down_write_nested(&eb->lock, nest); in __btrfs_tree_lock()
199 eb->lock_owner = current->pid; in __btrfs_tree_lock()
200 trace_btrfs_tree_lock(eb, start_ns); in __btrfs_tree_lock()
203 void btrfs_tree_lock(struct extent_buffer *eb) in btrfs_tree_lock() argument
205 __btrfs_tree_lock(eb, BTRFS_NESTING_NORMAL); in btrfs_tree_lock()
211 void btrfs_tree_unlock(struct extent_buffer *eb) in btrfs_tree_unlock() argument
213 trace_btrfs_tree_unlock(eb); in btrfs_tree_unlock()
214 eb->lock_owner = 0; in btrfs_tree_unlock()
215 up_write(&eb->lock); in btrfs_tree_unlock()
252 struct extent_buffer *eb; in btrfs_lock_root_node() local
254 while (1) { in btrfs_lock_root_node()
255 eb = btrfs_root_node(root); in btrfs_lock_root_node()
257 btrfs_maybe_reset_lockdep_class(root, eb); in btrfs_lock_root_node()
258 btrfs_tree_lock(eb); in btrfs_lock_root_node()
259 if (eb == root->node) in btrfs_lock_root_node()
261 btrfs_tree_unlock(eb); in btrfs_lock_root_node()
262 free_extent_buffer(eb); in btrfs_lock_root_node()
264 return eb; in btrfs_lock_root_node()
275 struct extent_buffer *eb; in btrfs_read_lock_root_node() local
277 while (1) { in btrfs_read_lock_root_node()
278 eb = btrfs_root_node(root); in btrfs_read_lock_root_node()
280 btrfs_maybe_reset_lockdep_class(root, eb); in btrfs_read_lock_root_node()
281 btrfs_tree_read_lock(eb); in btrfs_read_lock_root_node()
282 if (eb == root->node) in btrfs_read_lock_root_node()
284 btrfs_tree_read_unlock(eb); in btrfs_read_lock_root_node()
285 free_extent_buffer(eb); in btrfs_read_lock_root_node()
287 return eb; in btrfs_read_lock_root_node()
299 struct extent_buffer *eb; in btrfs_try_read_lock_root_node() local
301 while (1) { in btrfs_try_read_lock_root_node()
302 eb = btrfs_root_node(root); in btrfs_try_read_lock_root_node()
303 if (!btrfs_try_tree_read_lock(eb)) { in btrfs_try_read_lock_root_node()
304 free_extent_buffer(eb); in btrfs_try_read_lock_root_node()
307 if (eb == root->node) in btrfs_try_read_lock_root_node()
309 btrfs_tree_read_unlock(eb); in btrfs_try_read_lock_root_node()
310 free_extent_buffer(eb); in btrfs_try_read_lock_root_node()
312 return eb; in btrfs_try_read_lock_root_node()