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.

Dependency Surface

Detected Declarations

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

Implementation Notes