fs/ocfs2/alloc.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/alloc.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/alloc.c- Extension
.c- Size
- 202002 bytes
- Lines
- 7742
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/types.hlinux/slab.hlinux/string.hlinux/highmem.hlinux/swap.hlinux/quotaops.hlinux/blkdev.hlinux/sched/signal.hcluster/masklog.hocfs2.halloc.haops.hblockcheck.hdlmglue.hextent_map.hinode.hjournal.hlocalalloc.hsuballoc.hsysfile.hfile.hsuper.huptodate.hxattr.hrefcounttree.hocfs2_trace.hbuffer_head_io.h
Detected Declarations
struct ocfs2_extent_tree_operationsstruct ocfs2_insert_typestruct ocfs2_merge_ctxtstruct find_path_datastruct ocfs2_cached_block_freestruct ocfs2_per_slot_free_listenum ocfs2_contig_typeenum ocfs2_append_typeenum ocfs2_split_typefunction ocfs2_dinode_set_last_eb_blkfunction ocfs2_dinode_get_last_eb_blkfunction ocfs2_dinode_update_clustersfunction ocfs2_dinode_extent_map_insertfunction ocfs2_dinode_extent_map_truncatefunction ocfs2_dinode_insert_checkfunction ocfs2_dinode_sanity_checkfunction ocfs2_dinode_fill_root_elfunction ocfs2_xattr_value_fill_root_elfunction ocfs2_xattr_value_set_last_eb_blkfunction ocfs2_xattr_value_get_last_eb_blkfunction ocfs2_xattr_value_update_clustersfunction ocfs2_xattr_tree_fill_root_elfunction ocfs2_xattr_tree_fill_max_leaf_clustersfunction ocfs2_xattr_tree_set_last_eb_blkfunction ocfs2_xattr_tree_get_last_eb_blkfunction ocfs2_xattr_tree_update_clustersfunction ocfs2_dx_root_set_last_eb_blkfunction ocfs2_dx_root_get_last_eb_blkfunction ocfs2_dx_root_update_clustersfunction ocfs2_dx_root_sanity_checkfunction ocfs2_dx_root_fill_root_elfunction ocfs2_refcount_tree_fill_root_elfunction ocfs2_refcount_tree_set_last_eb_blkfunction ocfs2_refcount_tree_get_last_eb_blkfunction ocfs2_refcount_tree_update_clustersfunction ocfs2_refcount_tree_extent_contigfunction __ocfs2_init_extent_treefunction ocfs2_init_dinode_extent_treefunction ocfs2_init_xattr_tree_extent_treefunction ocfs2_init_xattr_value_extent_treefunction ocfs2_init_dx_root_extent_treefunction ocfs2_init_refcount_extent_treefunction ocfs2_et_set_last_eb_blkfunction ocfs2_et_get_last_eb_blkfunction ocfs2_et_update_clustersfunction ocfs2_et_extent_map_insertfunction ocfs2_et_extent_map_truncatefunction ocfs2_et_root_journal_access
Annotated Snippet
struct ocfs2_extent_tree_operations {
/*
* last_eb_blk is the block number of the right most leaf extent
* block. Most on-disk structures containing an extent tree store
* this value for fast access. The ->eo_set_last_eb_blk() and
* ->eo_get_last_eb_blk() operations access this value. They are
* both required.
*/
void (*eo_set_last_eb_blk)(struct ocfs2_extent_tree *et,
u64 blkno);
u64 (*eo_get_last_eb_blk)(struct ocfs2_extent_tree *et);
/*
* The on-disk structure usually keeps track of how many total
* clusters are stored in this extent tree. This function updates
* that value. new_clusters is the delta, and must be
* added to the total. Required.
*/
void (*eo_update_clusters)(struct ocfs2_extent_tree *et,
u32 new_clusters);
/*
* If this extent tree is supported by an extent map, insert
* a record into the map.
*/
void (*eo_extent_map_insert)(struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *rec);
/*
* If this extent tree is supported by an extent map, truncate the
* map to clusters,
*/
void (*eo_extent_map_truncate)(struct ocfs2_extent_tree *et,
u32 clusters);
/*
* If ->eo_insert_check() exists, it is called before rec is
* inserted into the extent tree. It is optional.
*/
int (*eo_insert_check)(struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *rec);
int (*eo_sanity_check)(struct ocfs2_extent_tree *et);
/*
* --------------------------------------------------------------
* The remaining are internal to ocfs2_extent_tree and don't have
* accessor functions
*/
/*
* ->eo_fill_root_el() takes et->et_object and sets et->et_root_el.
* It is required.
*/
void (*eo_fill_root_el)(struct ocfs2_extent_tree *et);
/*
* ->eo_fill_max_leaf_clusters sets et->et_max_leaf_clusters if
* it exists. If it does not, et->et_max_leaf_clusters is set
* to 0 (unlimited). Optional.
*/
void (*eo_fill_max_leaf_clusters)(struct ocfs2_extent_tree *et);
/*
* ->eo_extent_contig test whether the 2 ocfs2_extent_rec
* are contiguous or not. Optional. Don't need to set it if use
* ocfs2_extent_rec as the tree leaf.
*/
enum ocfs2_contig_type
(*eo_extent_contig)(struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *ext,
struct ocfs2_extent_rec *insert_rec);
};
/*
* Pre-declare ocfs2_dinode_et_ops so we can use it as a sanity check
* in the methods.
*/
static u64 ocfs2_dinode_get_last_eb_blk(struct ocfs2_extent_tree *et);
static void ocfs2_dinode_set_last_eb_blk(struct ocfs2_extent_tree *et,
u64 blkno);
static void ocfs2_dinode_update_clusters(struct ocfs2_extent_tree *et,
u32 clusters);
static void ocfs2_dinode_extent_map_insert(struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *rec);
static void ocfs2_dinode_extent_map_truncate(struct ocfs2_extent_tree *et,
u32 clusters);
static int ocfs2_dinode_insert_check(struct ocfs2_extent_tree *et,
struct ocfs2_extent_rec *rec);
static int ocfs2_dinode_sanity_check(struct ocfs2_extent_tree *et);
Annotation
- Immediate include surface: `linux/fs.h`, `linux/types.h`, `linux/slab.h`, `linux/string.h`, `linux/highmem.h`, `linux/swap.h`, `linux/quotaops.h`, `linux/blkdev.h`.
- Detected declarations: `struct ocfs2_extent_tree_operations`, `struct ocfs2_insert_type`, `struct ocfs2_merge_ctxt`, `struct find_path_data`, `struct ocfs2_cached_block_free`, `struct ocfs2_per_slot_free_list`, `enum ocfs2_contig_type`, `enum ocfs2_append_type`, `enum ocfs2_split_type`, `function ocfs2_dinode_set_last_eb_blk`.
- 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.