fs/btrfs/locking.h
Source file repositories/reference/linux-study-clean/fs/btrfs/locking.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/locking.h- Extension
.h- Size
- 8264 bytes
- Lines
- 252
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/atomic.hlinux/wait.hlinux/lockdep.hlinux/percpu_counter.hextent_io.h
Detected Declarations
struct extent_bufferstruct btrfs_pathstruct btrfs_rootstruct btrfs_drew_lockenum btrfs_lock_nestingenum btrfs_lockdep_trans_statesfunction btrfs_tree_lockfunction btrfs_tree_read_lockfunction btrfs_assert_tree_write_lockedfunction btrfs_assert_tree_read_lockedfunction btrfs_assert_tree_write_lockedfunction btrfs_tree_unlock_rwfunction btrfs_set_buffer_lockdep_class
Annotated Snippet
struct btrfs_drew_lock {
atomic_t readers;
atomic_t writers;
wait_queue_head_t pending_writers;
wait_queue_head_t pending_readers;
};
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
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/wait.h`, `linux/lockdep.h`, `linux/percpu_counter.h`, `extent_io.h`.
- Detected declarations: `struct extent_buffer`, `struct btrfs_path`, `struct btrfs_root`, `struct btrfs_drew_lock`, `enum btrfs_lock_nesting`, `enum btrfs_lockdep_trans_states`, `function btrfs_tree_lock`, `function btrfs_tree_read_lock`, `function btrfs_assert_tree_write_locked`, `function btrfs_assert_tree_read_locked`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.