fs/btrfs/zoned.h
Source file repositories/reference/linux-study-clean/fs/btrfs/zoned.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/zoned.h- Extension
.h- Size
- 12366 bytes
- Lines
- 436
- 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/types.hlinux/atomic.hlinux/blkdev.hlinux/blkzoned.hlinux/errno.hlinux/spinlock.hlinux/mutex.hlinux/seq_file.hmessages.hvolumes.hdisk-io.hblock-group.hbtrfs_inode.h
Detected Declarations
struct block_devicestruct extent_bufferstruct btrfs_biostruct btrfs_ordered_extentstruct btrfs_fs_infostruct btrfs_space_infostruct btrfs_eb_write_contextstruct btrfs_fs_devicesstruct btrfs_zoned_device_infostruct zone_infofunction btrfs_get_dev_zone_info_all_devicesfunction btrfs_get_dev_zone_infofunction btrfs_destroy_dev_zone_infofunction btrfs_check_zoned_modefunction btrfs_check_mountopts_zonedfunction btrfs_sb_log_location_bdevfunction btrfs_sb_log_locationfunction btrfs_advance_sb_logfunction btrfs_reset_sb_log_zonesfunction btrfs_find_allocatable_zonesfunction btrfs_reset_device_zonefunction btrfs_ensure_empty_zonesfunction btrfs_load_block_group_zone_infofunction btrfs_calc_zone_unusablefunction btrfs_record_physical_zonedfunction btrfs_zoned_issue_zerooutfunction btrfs_sync_zone_write_pointerfunction btrfs_zone_activatefunction btrfs_zone_finishfunction btrfs_can_activate_zonefunction btrfs_zone_finish_endiofunction btrfs_schedule_zone_finish_bgfunction btrfs_zoned_release_data_reloc_bgfunction btrfs_zoned_activate_one_bgfunction btrfs_check_active_zone_reservationfunction btrfs_show_zoned_statsfunction btrfs_dev_is_sequentialfunction btrfs_dev_is_empty_zonefunction btrfs_dev_set_empty_zone_bitfunction btrfs_dev_set_zone_emptyfunction btrfs_dev_clear_zone_emptyfunction btrfs_check_device_zone_typefunction btrfs_check_super_locationfunction btrfs_can_zone_resetfunction btrfs_zoned_meta_io_lockfunction btrfs_zoned_meta_io_unlockfunction btrfs_clear_treelog_bgfunction btrfs_zoned_data_reloc_lock
Annotated Snippet
struct btrfs_zoned_device_info {
/*
* Number of zones, zone size and types of zones if bdev is a
* zoned block device.
*/
u64 zone_size;
u8 zone_size_shift;
u32 nr_zones;
unsigned int max_active_zones;
/*
* Reserved active zones for one metadata and one system block group.
* It can vary per-device depending on the allocation status.
*/
int reserved_active_zones;
atomic_t active_zones_left;
unsigned long *seq_zones;
unsigned long *empty_zones;
unsigned long *active_zones;
struct blk_zone *zone_cache;
struct blk_zone sb_zones[2 * BTRFS_SUPER_MIRROR_MAX];
};
void btrfs_finish_ordered_zoned(struct btrfs_ordered_extent *ordered);
#ifdef CONFIG_BLK_DEV_ZONED
int btrfs_get_dev_zone_info_all_devices(struct btrfs_fs_info *fs_info);
int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache);
void btrfs_destroy_dev_zone_info(struct btrfs_device *device);
struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *orig_dev);
int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info);
int btrfs_check_mountopts_zoned(const struct btrfs_fs_info *info,
unsigned long long *mount_opt);
int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
u64 *bytenr_ret);
int btrfs_sb_log_location(struct btrfs_device *device, int mirror, int rw,
u64 *bytenr_ret);
int btrfs_advance_sb_log(struct btrfs_device *device, int mirror);
int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror);
u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start,
u64 hole_end, u64 num_bytes);
int btrfs_reset_device_zone(struct btrfs_device *device, u64 physical,
u64 length, u64 *bytes);
int btrfs_ensure_empty_zones(struct btrfs_device *device, u64 start, u64 size);
int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new);
void btrfs_calc_zone_unusable(struct btrfs_block_group *cache);
bool btrfs_use_zone_append(struct btrfs_bio *bbio);
void btrfs_record_physical_zoned(struct btrfs_bio *bbio);
int btrfs_check_meta_write_pointer(struct btrfs_fs_info *fs_info,
struct btrfs_eb_write_context *ctx);
int btrfs_zoned_issue_zeroout(struct btrfs_device *device, u64 physical, u64 length);
int btrfs_sync_zone_write_pointer(struct btrfs_device *tgt_dev, u64 logical,
u64 physical_start, u64 physical_pos);
bool btrfs_zone_activate(struct btrfs_block_group *block_group);
int btrfs_zone_finish(struct btrfs_block_group *block_group);
bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flags);
int btrfs_zone_finish_endio(struct btrfs_fs_info *fs_info, u64 logical,
u64 length);
void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg,
struct extent_buffer *eb);
void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg);
void btrfs_zoned_reserve_data_reloc_bg(struct btrfs_fs_info *fs_info);
void btrfs_free_zone_cache(struct btrfs_fs_info *fs_info);
bool btrfs_zoned_should_reclaim(const struct btrfs_fs_info *fs_info);
void btrfs_zoned_release_data_reloc_bg(struct btrfs_fs_info *fs_info, u64 logical,
u64 length);
int btrfs_zone_finish_one_bg(struct btrfs_fs_info *fs_info);
int btrfs_zoned_activate_one_bg(struct btrfs_space_info *space_info, bool do_finish);
void btrfs_check_active_zone_reservation(struct btrfs_fs_info *fs_info);
int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num_bytes);
void btrfs_show_zoned_stats(struct btrfs_fs_info *fs_info, struct seq_file *seq);
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
struct zone_info;
int btrfs_load_block_group_by_raid_type(struct btrfs_block_group *bg,
struct btrfs_chunk_map *map,
struct zone_info *zone_info,
unsigned long *active, u64 last_alloc);
#endif
#else /* CONFIG_BLK_DEV_ZONED */
static inline int btrfs_get_dev_zone_info_all_devices(struct btrfs_fs_info *fs_info)
{
return 0;
}
static inline int btrfs_get_dev_zone_info(struct btrfs_device *device,
bool populate_cache)
{
Annotation
- Immediate include surface: `linux/types.h`, `linux/atomic.h`, `linux/blkdev.h`, `linux/blkzoned.h`, `linux/errno.h`, `linux/spinlock.h`, `linux/mutex.h`, `linux/seq_file.h`.
- Detected declarations: `struct block_device`, `struct extent_buffer`, `struct btrfs_bio`, `struct btrfs_ordered_extent`, `struct btrfs_fs_info`, `struct btrfs_space_info`, `struct btrfs_eb_write_context`, `struct btrfs_fs_devices`, `struct btrfs_zoned_device_info`, `struct zone_info`.
- 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.