fs/btrfs/block-group.h

Source file repositories/reference/linux-study-clean/fs/btrfs/block-group.h

File Facts

System
Linux kernel
Corpus path
fs/btrfs/block-group.h
Extension
.h
Size
14224 bytes
Lines
428
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct btrfs_caching_control {
	struct list_head list;
	struct mutex mutex;
	wait_queue_head_t wait;
	struct btrfs_work work;
	struct btrfs_block_group *block_group;
	/* Track progress of caching during allocation. */
	atomic_t progress;
	refcount_t count;
};

/* Once caching_thread() finds this much free space, it will wake up waiters. */
#define CACHING_CTL_WAKE_UP SZ_2M

struct btrfs_block_group {
	struct btrfs_fs_info *fs_info;
	struct btrfs_inode *inode;
	spinlock_t lock;
	unsigned int ro;
	u64 start;
	u64 length;
	u64 pinned;
	u64 reserved;
	u64 used;
	u64 delalloc_bytes;
	u64 bytes_super;
	u64 flags;
	u64 cache_generation;
	u64 global_root_id;
	u64 remap_bytes;
	u32 identity_remap_count;
	/* The last commited identity_remap_count value of this block group. */
	u32 last_identity_remap_count;
	/*
	 * The last committed used bytes of this block group, if the above @used
	 * is still the same as @last_used, we don't need to update block
	 * group item of this block group.
	 */
	u64 last_used;
	/* The last committed remap_bytes value of this block group. */
	u64 last_remap_bytes;
	/* The last committed flags value for this block group. */
	u64 last_flags;

	/*
	 * If the free space extent count exceeds this number, convert the block
	 * group to bitmaps.
	 */
	u32 bitmap_high_thresh;

	/*
	 * If the free space extent count drops below this number, convert the
	 * block group back to extents.
	 */
	u32 bitmap_low_thresh;

	/*
	 * It is just used for the delayed data space allocation because
	 * only the data space allocation and the relative metadata update
	 * can be done cross the transaction.
	 */
	struct rw_semaphore data_rwsem;

	/* For raid56, this is a full stripe, without parity */
	unsigned long full_stripe_len;
	unsigned long runtime_flags;

	enum btrfs_disk_cache_state disk_cache_state;

	/* Cache tracking stuff */
	enum btrfs_caching_type cached;
	struct btrfs_caching_control *caching_ctl;

	struct btrfs_space_info *space_info;

	/* Free space cache stuff */
	struct btrfs_free_space_ctl *free_space_ctl;

	/* Block group cache stuff */
	struct rb_node cache_node;

	/* For block groups in the same raid type */
	struct list_head list;

	refcount_t refs;

	/*
	 * When non-zero it means the block group's logical address and its
	 * device extents can not be reused for future block group allocations
	 * until the counter goes down to 0. This is to prevent them from being

Annotation

Implementation Notes