fs/btrfs/space-info.h
Source file repositories/reference/linux-study-clean/fs/btrfs/space-info.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/space-info.h- Extension
.h- Size
- 10996 bytes
- Lines
- 356
- 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
trace/events/btrfs.hlinux/spinlock.hlinux/list.hlinux/kobject.hlinux/lockdep.hlinux/wait.hlinux/rwsem.hvolumes.h
Detected Declarations
struct btrfs_fs_infostruct btrfs_block_groupstruct btrfs_space_infoenum btrfs_reserve_flush_enumenum btrfs_flush_stateenum btrfs_space_info_sub_groupfunction btrfs_mixed_space_infofunction btrfs_space_info_usedfunction btrfs_space_info_free_bytes_may_use
Annotated Snippet
struct btrfs_space_info {
struct btrfs_fs_info *fs_info;
struct btrfs_space_info *parent;
struct btrfs_space_info *sub_group[BTRFS_SPACE_INFO_SUB_GROUP_MAX];
int subgroup_id;
spinlock_t lock;
u64 total_bytes; /* total bytes in the space,
this doesn't take mirrors into account */
u64 bytes_used; /* total bytes used,
this doesn't take mirrors into account */
u64 bytes_pinned; /* total bytes pinned, will be freed when the
transaction finishes */
u64 bytes_reserved; /* total bytes the allocator has reserved for
current allocations */
u64 bytes_may_use; /* number of bytes that may be used for
delalloc/allocations */
u64 bytes_readonly; /* total bytes that are read only */
u64 bytes_zone_unusable; /* total bytes that are unusable until
resetting the device zone */
u64 max_extent_size; /* This will hold the maximum extent size of
the space info if we had an ENOSPC in the
allocator. */
/* Chunk size in bytes */
u64 chunk_size;
/*
* Once a block group drops below this threshold (percents) we'll
* schedule it for reclaim.
*/
int bg_reclaim_threshold;
int clamp; /* Used to scale our threshold for preemptive
flushing. The value is >> clamp, so turns
out to be a 2^clamp divisor. */
bool full; /* indicates that we cannot allocate any more
chunks for this space */
bool chunk_alloc; /* set if we are allocating a chunk */
bool flush; /* set if we are trying to make space */
unsigned int force_alloc; /* set if we need to force a chunk
alloc for this space */
u64 disk_used; /* total bytes used on disk */
u64 disk_total; /* total bytes on disk, takes mirrors into
account */
u64 flags;
struct list_head list;
/* Protected by the spinlock 'lock'. */
struct list_head ro_bgs;
struct list_head priority_tickets;
struct list_head tickets;
/*
* Size of space that needs to be reclaimed in order to satisfy pending
* tickets
*/
u64 reclaim_size;
/*
* tickets_id just indicates the next ticket will be handled, so note
* it's not stored per ticket.
*/
u64 tickets_id;
struct rw_semaphore groups_sem;
/* for block groups in our same type */
struct list_head block_groups[BTRFS_NR_RAID_TYPES];
struct kobject kobj;
struct kobject *block_group_kobjs[BTRFS_NR_RAID_TYPES];
/*
* Monotonically increasing counter of block group reclaim attempts
* Exposed in /sys/fs/<uuid>/allocation/<type>/reclaim_count
*/
u64 reclaim_count;
/*
* Monotonically increasing counter of reclaimed bytes
* Exposed in /sys/fs/<uuid>/allocation/<type>/reclaim_bytes
*/
u64 reclaim_bytes;
/*
Annotation
- Immediate include surface: `trace/events/btrfs.h`, `linux/spinlock.h`, `linux/list.h`, `linux/kobject.h`, `linux/lockdep.h`, `linux/wait.h`, `linux/rwsem.h`, `volumes.h`.
- Detected declarations: `struct btrfs_fs_info`, `struct btrfs_block_group`, `struct btrfs_space_info`, `enum btrfs_reserve_flush_enum`, `enum btrfs_flush_state`, `enum btrfs_space_info_sub_group`, `function btrfs_mixed_space_info`, `function btrfs_space_info_used`, `function btrfs_space_info_free_bytes_may_use`.
- 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.