fs/ocfs2/aops.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/aops.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/aops.c- Extension
.c- Size
- 63889 bytes
- Lines
- 2480
- 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/slab.hlinux/highmem.hlinux/pagemap.hasm/byteorder.hlinux/swap.hlinux/mpage.hlinux/quotaops.hlinux/blkdev.hlinux/uio.hlinux/mm.hcluster/masklog.hocfs2.halloc.haops.hdlmglue.hextent_map.hfile.hinode.hjournal.hsuballoc.hsuper.hsymlink.hrefcounttree.hocfs2_trace.hbuffer_head_io.hdir.hnamei.hsysfile.h
Detected Declarations
struct ocfs2_unwritten_extentstruct ocfs2_write_cluster_descstruct ocfs2_write_ctxtstruct ocfs2_dio_write_ctxtfunction Copyrightfunction ocfs2_lock_get_blockfunction ocfs2_get_blockfunction __block_write_beginfunction ocfs2_read_inline_datafunction ocfs2_readpage_inlinefunction ocfs2_read_foliofunction sys_readaheadfunction largefunction happenedfunction bugsfunction ocfs2_bmapfunction ocfs2_release_foliofunction ocfs2_figure_cluster_boundariesfunction ocfs2_clear_folio_regionsfunction ocfs2_should_read_blkfunction __block_write_beginfunction ocfs2_should_read_blkfunction ocfs2_unlock_and_free_foliosfunction ocfs2_unlock_foliosfunction page_mkwritefunction ocfs2_free_unwritten_listfunction list_for_each_entry_safefunction ocfs2_free_write_ctxtfunction ocfs2_alloc_write_ctxtfunction ocfs2_zero_new_buffersfunction ocfs2_write_failurefunction ocfs2_prepare_folio_for_writefunction ocfs2_grab_folios_for_writefunction ocfs2_write_clusterfunction ocfs2_write_cluster_by_descfunction ocfs2_write_endfunction ocfs2_unwritten_checkfunction ocfs2_populate_write_descfunction ocfs2_write_begin_inlinefunction ocfs2_size_fits_inline_datafunction ocfs2_try_to_write_inline_datafunction ocfs2_expand_nonsparse_inodefunction ocfs2_zero_tailfunction ocfs2_write_begin_nolockfunction ocfs2_write_endfunction ocfs2_grab_folios_for_writefunction ocfs2_write_beginfunction ocfs2_write_end_inline
Annotated Snippet
struct ocfs2_unwritten_extent {
struct list_head ue_node;
struct list_head ue_ip_node;
u32 ue_cpos;
u32 ue_phys;
};
/*
* Describe the state of a single cluster to be written to.
*/
struct ocfs2_write_cluster_desc {
u32 c_cpos;
u32 c_phys;
/*
* Give this a unique field because c_phys eventually gets
* filled.
*/
unsigned c_new;
unsigned c_clear_unwritten;
unsigned c_needs_zero;
};
struct ocfs2_write_ctxt {
/* Logical cluster position / len of write */
u32 w_cpos;
u32 w_clen;
/* First cluster allocated in a nonsparse extend */
u32 w_first_new_cpos;
/* Type of caller. Must be one of buffer, mmap, direct. */
ocfs2_write_type_t w_type;
struct ocfs2_write_cluster_desc w_desc[OCFS2_MAX_CLUSTERS_PER_PAGE];
/*
* This is true if page_size > cluster_size.
*
* It triggers a set of special cases during write which might
* have to deal with allocating writes to partial pages.
*/
unsigned int w_large_pages;
/*
* Folios involved in this write.
*
* w_target_folio is the folio being written to by the user.
*
* w_folios is an array of folios which always contains
* w_target_folio, and in the case of an allocating write with
* page_size < cluster size, it will contain zero'd and mapped
* pages adjacent to w_target_folio which need to be written
* out in so that future reads from that region will get
* zero's.
*/
unsigned int w_num_folios;
struct folio *w_folios[OCFS2_MAX_CTXT_PAGES];
struct folio *w_target_folio;
/*
* w_target_locked is used for page_mkwrite path indicating no unlocking
* against w_target_folio in ocfs2_write_end_nolock.
*/
unsigned int w_target_locked:1;
/*
* ocfs2_write_end() uses this to know what the real range to
* write in the target should be.
*/
unsigned int w_target_from;
unsigned int w_target_to;
/*
* We could use journal_current_handle() but this is cleaner,
* IMHO -Mark
*/
handle_t *w_handle;
struct buffer_head *w_di_bh;
struct ocfs2_cached_dealloc_ctxt w_dealloc;
struct list_head w_unwritten_list;
unsigned int w_unwritten_count;
};
void ocfs2_unlock_and_free_folios(struct folio **folios, int num_folios)
{
int i;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/slab.h`, `linux/highmem.h`, `linux/pagemap.h`, `asm/byteorder.h`, `linux/swap.h`, `linux/mpage.h`, `linux/quotaops.h`.
- Detected declarations: `struct ocfs2_unwritten_extent`, `struct ocfs2_write_cluster_desc`, `struct ocfs2_write_ctxt`, `struct ocfs2_dio_write_ctxt`, `function Copyright`, `function ocfs2_lock_get_block`, `function ocfs2_get_block`, `function __block_write_begin`, `function ocfs2_read_inline_data`, `function ocfs2_readpage_inline`.
- 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.