#ifndef BTRFS_LOCKING_H
#define BTRFS_LOCKING_H
#include <linux/atomic.h>
#include <linux/wait.h>
#include <linux/lockdep.h>
#include <linux/percpu_counter.h>
#include "extent_io.h"
struct extent_buffer;
struct btrfs_path;
struct btrfs_root;
#define BTRFS_WRITE_LOCK …
#define BTRFS_READ_LOCK …
enum btrfs_lock_nesting { … };
enum btrfs_lockdep_trans_states { … };
#define btrfs_might_wait_for_event(owner, lock) …
#define btrfs_lockdep_acquire(owner, lock) …
#define btrfs_lockdep_release(owner, lock) …
#define btrfs_might_wait_for_state(owner, i) …
#define btrfs_trans_state_lockdep_acquire(owner, i) …
#define btrfs_trans_state_lockdep_release(owner, i) …
#define btrfs_lockdep_init_map(owner, lock) …
#define btrfs_state_lockdep_init_map(owner, lock, state) …
static_assert(…);
void btrfs_tree_lock_nested(struct extent_buffer *eb, enum btrfs_lock_nesting nest);
static inline void btrfs_tree_lock(struct extent_buffer *eb)
{ … }
void btrfs_tree_unlock(struct extent_buffer *eb);
void btrfs_tree_read_lock_nested(struct extent_buffer *eb, enum btrfs_lock_nesting nest);
static inline void btrfs_tree_read_lock(struct extent_buffer *eb)
{ … }
void btrfs_tree_read_unlock(struct extent_buffer *eb);
int btrfs_try_tree_read_lock(struct extent_buffer *eb);
int btrfs_try_tree_write_lock(struct extent_buffer *eb);
struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root);
struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root);
#ifdef CONFIG_BTRFS_DEBUG
static inline void btrfs_assert_tree_write_locked(struct extent_buffer *eb)
{ … }
#else
static inline void btrfs_assert_tree_write_locked(struct extent_buffer *eb) { }
#endif
void btrfs_unlock_up_safe(struct btrfs_path *path, int level);
static inline void btrfs_tree_unlock_rw(struct extent_buffer *eb, int rw)
{ … }
struct btrfs_drew_lock { … };
void btrfs_drew_lock_init(struct btrfs_drew_lock *lock);
void btrfs_drew_write_lock(struct btrfs_drew_lock *lock);
bool btrfs_drew_try_write_lock(struct btrfs_drew_lock *lock);
void btrfs_drew_write_unlock(struct btrfs_drew_lock *lock);
void btrfs_drew_read_lock(struct btrfs_drew_lock *lock);
void btrfs_drew_read_unlock(struct btrfs_drew_lock *lock);
#ifdef CONFIG_DEBUG_LOCK_ALLOC
void btrfs_set_buffer_lockdep_class(u64 objectid, struct extent_buffer *eb, int level);
void btrfs_maybe_reset_lockdep_class(struct btrfs_root *root, struct extent_buffer *eb);
#else
static inline void btrfs_set_buffer_lockdep_class(u64 objectid,
struct extent_buffer *eb, int level)
{
}
static inline void btrfs_maybe_reset_lockdep_class(struct btrfs_root *root,
struct extent_buffer *eb)
{
}
#endif
#endif