fs/btrfs/extent_map.h
Source file repositories/reference/linux-study-clean/fs/btrfs/extent_map.h
File Facts
- System
- Linux kernel
- Corpus path
fs/btrfs/extent_map.h- Extension
.h- Size
- 5655 bytes
- Lines
- 196
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler_types.hlinux/spinlock_types.hlinux/rbtree.hlinux/list.hlinux/refcount.hfs.h
Detected Declarations
struct btrfs_inodestruct btrfs_fs_infostruct extent_mapstruct extent_map_treestruct btrfs_inodefunction btrfs_extent_map_set_compressionfunction btrfs_extent_map_compressionfunction btrfs_extent_map_is_compressedfunction btrfs_extent_map_in_treefunction btrfs_extent_map_block_startfunction btrfs_extent_map_end
Annotated Snippet
struct extent_map {
struct rb_node rb_node;
/* All of these are in bytes. */
/* File offset matching the offset of a BTRFS_EXTENT_ITEM_KEY key. */
u64 start;
/*
* Length of the file extent.
*
* For non-inlined file extents it's btrfs_file_extent_item::num_bytes.
* For inline extents it's sectorsize, since inline data starts at
* offsetof(struct btrfs_file_extent_item, disk_bytenr) thus
* btrfs_file_extent_item::num_bytes is not valid.
*/
u64 len;
/*
* The bytenr of the full on-disk extent.
*
* For regular extents it's btrfs_file_extent_item::disk_bytenr.
* For holes it's EXTENT_MAP_HOLE and for inline extents it's
* EXTENT_MAP_INLINE.
*/
u64 disk_bytenr;
/*
* The full on-disk extent length, matching
* btrfs_file_extent_item::disk_num_bytes.
*/
u64 disk_num_bytes;
/*
* Offset inside the decompressed extent.
*
* For regular extents it's btrfs_file_extent_item::offset.
* For holes and inline extents it's 0.
*/
u64 offset;
/*
* The decompressed size of the whole on-disk extent, matching
* btrfs_file_extent_item::ram_bytes.
*/
u64 ram_bytes;
/*
* Generation of the extent map, for merged em it's the highest
* generation of all merged ems.
* For non-merged extents, it's from btrfs_file_extent_item::generation.
*/
u64 generation;
u32 flags;
refcount_t refs;
struct list_head list;
};
struct extent_map_tree {
struct rb_root root;
struct list_head modified_extents;
rwlock_t lock;
};
struct btrfs_inode;
static inline void btrfs_extent_map_set_compression(struct extent_map *em,
enum btrfs_compression_type type)
{
if (type == BTRFS_COMPRESS_ZLIB)
em->flags |= EXTENT_FLAG_COMPRESS_ZLIB;
else if (type == BTRFS_COMPRESS_LZO)
em->flags |= EXTENT_FLAG_COMPRESS_LZO;
else if (type == BTRFS_COMPRESS_ZSTD)
em->flags |= EXTENT_FLAG_COMPRESS_ZSTD;
}
static inline enum btrfs_compression_type btrfs_extent_map_compression(
const struct extent_map *em)
{
if (em->flags & EXTENT_FLAG_COMPRESS_ZLIB)
return BTRFS_COMPRESS_ZLIB;
if (em->flags & EXTENT_FLAG_COMPRESS_LZO)
return BTRFS_COMPRESS_LZO;
if (em->flags & EXTENT_FLAG_COMPRESS_ZSTD)
return BTRFS_COMPRESS_ZSTD;
return BTRFS_COMPRESS_NONE;
Annotation
- Immediate include surface: `linux/compiler_types.h`, `linux/spinlock_types.h`, `linux/rbtree.h`, `linux/list.h`, `linux/refcount.h`, `fs.h`.
- Detected declarations: `struct btrfs_inode`, `struct btrfs_fs_info`, `struct extent_map`, `struct extent_map_tree`, `struct btrfs_inode`, `function btrfs_extent_map_set_compression`, `function btrfs_extent_map_compression`, `function btrfs_extent_map_is_compressed`, `function btrfs_extent_map_in_tree`, `function btrfs_extent_map_block_start`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.