fs/erofs/zdata.c
Source file repositories/reference/linux-study-clean/fs/erofs/zdata.c
File Facts
- System
- Linux kernel
- Corpus path
fs/erofs/zdata.c- Extension
.c- Size
- 52660 bytes
- Lines
- 1950
- 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
compress.hlinux/psi.hlinux/cpuhotplug.htrace/events/erofs.h
Detected Declarations
struct z_erofs_bvecstruct namestruct z_erofs_pclusterstruct z_erofs_decompressqueuestruct z_erofs_pcluster_slabstruct z_erofs_bvec_iterstruct z_erofs_frontendstruct z_erofs_backendstruct z_erofs_bvec_itemenum z_erofs_pclustermodefunction z_erofs_pclusterpagesfunction erofs_folio_is_managedfunction z_erofs_bvec_iter_beginfunction z_erofs_bvec_enqueuefunction z_erofs_bvec_dequeuefunction z_erofs_destroy_pcluster_poolfunction z_erofs_create_pcluster_poolfunction z_erofs_free_pclusterfunction erofs_destroy_percpu_workersfunction for_each_possible_cpufunction erofs_init_percpu_workersfunction for_each_online_cpufunction erofs_cpu_onlinefunction erofs_cpu_offlinefunction erofs_cpu_hotplug_initfunction erofs_cpu_hotplug_destroyfunction erofs_cpu_hotplug_initfunction erofs_cpu_hotplug_destroyfunction z_erofs_destroy_pcpu_workersfunction z_erofs_init_pcpu_workersfunction z_erofs_destroy_pcpu_workersfunction z_erofs_init_subsystemfunction z_erofs_should_alloc_cachefunction z_erofs_bind_cachefunction erofs_try_to_free_all_cached_foliosfunction z_erofs_cache_release_foliofunction z_erofs_cache_invalidate_foliofunction z_erofs_init_superfunction z_erofs_attach_pagefunction z_erofs_get_pclusterfunction z_erofs_register_pclusterfunction z_erofs_pcluster_beginfunction z_erofs_rcu_callbackfunction __erofs_try_to_release_pclusterfunction erofs_try_to_release_pclusterfunction z_erofs_shrink_scanfunction z_erofs_put_pclusterfunction z_erofs_pcluster_end
Annotated Snippet
struct z_erofs_bvec {
struct page *page;
int offset;
unsigned int end;
};
#define __Z_EROFS_BVSET(name, total) \
struct name { \
/* point to the next page which contains the following bvecs */ \
struct page *nextpage; \
struct z_erofs_bvec bvec[total]; \
}
__Z_EROFS_BVSET(z_erofs_bvset,);
__Z_EROFS_BVSET(z_erofs_bvset_inline, Z_EROFS_INLINE_BVECS);
/*
* Structure fields follow one of the following exclusion rules.
*
* I: Modifiable by initialization/destruction paths and read-only
* for everyone else;
*
* L: Field should be protected by the pcluster lock;
*
* A: Field should be accessed / updated in atomic for parallelized code.
*/
struct z_erofs_pcluster {
struct mutex lock;
struct lockref lockref;
/* A: point to next chained pcluster or TAILs */
struct z_erofs_pcluster *next;
/* I: start physical position of this pcluster */
erofs_off_t pos;
/* L: the maximum decompression size of this round */
unsigned int length;
/* L: total number of bvecs */
unsigned int vcnt;
/* I: pcluster size (compressed size) in bytes */
unsigned int pclustersize;
/* I: page offset of start position of decompression */
unsigned short pageofs_out;
/* I: page offset of inline compressed data */
unsigned short pageofs_in;
union {
/* L: inline a certain number of bvec for bootstrap */
struct z_erofs_bvset_inline bvset;
/* I: can be used to free the pcluster by RCU. */
struct rcu_head rcu;
};
/* I: compression algorithm format */
unsigned char algorithmformat;
/* I: whether compressed data is in-lined or not */
bool from_meta;
/* L: whether partial decompression or not */
bool partial;
/* L: whether extra buffer allocations are best-effort */
bool besteffort;
/* A: compressed bvecs (can be cached or inplaced pages) */
struct z_erofs_bvec compressed_bvecs[];
};
/* the end of a chain of pclusters */
#define Z_EROFS_PCLUSTER_TAIL ((void *) 0x700 + POISON_POINTER_DELTA)
struct z_erofs_decompressqueue {
struct super_block *sb;
struct z_erofs_pcluster *head;
atomic_t pending_bios;
union {
struct completion done;
struct work_struct work;
struct kthread_work kthread_work;
} u;
bool eio, sync;
};
Annotation
- Immediate include surface: `compress.h`, `linux/psi.h`, `linux/cpuhotplug.h`, `trace/events/erofs.h`.
- Detected declarations: `struct z_erofs_bvec`, `struct name`, `struct z_erofs_pcluster`, `struct z_erofs_decompressqueue`, `struct z_erofs_pcluster_slab`, `struct z_erofs_bvec_iter`, `struct z_erofs_frontend`, `struct z_erofs_backend`, `struct z_erofs_bvec_item`, `enum z_erofs_pclustermode`.
- 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.