fs/gfs2/incore.h
Source file repositories/reference/linux-study-clean/fs/gfs2/incore.h
File Facts
- System
- Linux kernel
- Corpus path
fs/gfs2/incore.h- Extension
.h- Size
- 23945 bytes
- Lines
- 883
- 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/fs.hlinux/kobject.hlinux/workqueue.hlinux/dlm.hlinux/buffer_head.hlinux/rcupdate.hlinux/rculist_bl.hlinux/completion.hlinux/rbtree.hlinux/ktime.hlinux/percpu.hlinux/lockref.hlinux/rhashtable.hlinux/mutex.h
Detected Declarations
struct gfs2_log_operationsstruct gfs2_bufdatastruct gfs2_holderstruct gfs2_glockstruct gfs2_quota_datastruct gfs2_transstruct gfs2_jdescstruct gfs2_sbdstruct lm_lockopsstruct gfs2_log_header_hoststruct gfs2_log_operationsstruct gfs2_bitmapstruct gfs2_rgrpdstruct gfs2_bufdatastruct lm_locknamestruct gfs2_glock_operationsstruct gfs2_lkstatsstruct gfs2_holderstruct gfs2_qadatastruct gfs2_blkreservstruct gfs2_alloc_parmsstruct gfs2_glockstruct gfs2_inodestruct gfs2_filestruct gfs2_revoke_replaystruct gfs2_quota_datastruct gfs2_transstruct gfs2_journal_extentstruct gfs2_jdescstruct gfs2_statfs_change_hoststruct gfs2_argsstruct gfs2_tunestruct gfs2_inum_hoststruct gfs2_sb_hoststruct lm_lockstructstruct gfs2_pcpu_lkstatsstruct local_statfs_inodestruct gfs2_sbdenum gfs2_state_bitsfunction glock_typefunction glock_numberfunction gfs2_glstats_incfunction gfs2_sbstats_incfunction gfs2_max_stuffed_size
Annotated Snippet
struct gfs2_log_header_host {
u64 lh_sequence; /* Sequence number of this transaction */
u32 lh_flags; /* GFS2_LOG_HEAD_... */
u32 lh_tail; /* Block number of log tail */
u32 lh_blkno;
s64 lh_local_total;
s64 lh_local_free;
s64 lh_local_dinodes;
};
/*
* Structure of operations that are associated with each
* type of element in the log.
*/
struct gfs2_log_operations {
void (*lo_before_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
void (*lo_after_commit) (struct gfs2_sbd *sdp, struct gfs2_trans *tr);
void (*lo_before_scan) (struct gfs2_jdesc *jd,
struct gfs2_log_header_host *head, int pass);
int (*lo_scan_elements) (struct gfs2_jdesc *jd, unsigned int start,
struct gfs2_log_descriptor *ld, __be64 *ptr,
int pass);
void (*lo_after_scan) (struct gfs2_jdesc *jd, int error, int pass);
const char *lo_name;
};
#define GBF_FULL 1
/**
* Clone bitmaps (bi_clone):
*
* - When a block is freed, we remember the previous state of the block in the
* clone bitmap, and only mark the block as free in the real bitmap.
*
* - When looking for a block to allocate, we check for a free block in the
* clone bitmap, and if no clone bitmap exists, in the real bitmap.
*
* - For allocating a block, we mark it as allocated in the real bitmap, and if
* a clone bitmap exists, also in the clone bitmap.
*
* - At the end of a log_flush, we copy the real bitmap into the clone bitmap
* to make the clone bitmap reflect the current allocation state.
* (Alternatively, we could remove the clone bitmap.)
*
* The clone bitmaps are in-core only, and is never written to disk.
*
* These steps ensure that blocks which have been freed in a transaction cannot
* be reallocated in that same transaction.
*/
struct gfs2_bitmap {
struct buffer_head *bi_bh;
char *bi_clone;
unsigned long bi_flags;
u32 bi_offset;
u32 bi_start;
u32 bi_bytes;
u32 bi_blocks;
};
struct gfs2_rgrpd {
struct rb_node rd_node; /* Link with superblock */
struct gfs2_glock *rd_gl; /* Glock for this rgrp */
u64 rd_addr; /* grp block disk address */
u64 rd_data0; /* first data location */
u32 rd_length; /* length of rgrp header in fs blocks */
u32 rd_data; /* num of data blocks in rgrp */
u32 rd_bitbytes; /* number of bytes in data bitmaps */
u32 rd_free;
u32 rd_requested; /* number of blocks in rd_rstree */
u32 rd_reserved; /* number of reserved blocks */
u32 rd_free_clone;
u32 rd_dinodes;
u64 rd_igeneration;
struct gfs2_bitmap *rd_bits;
struct gfs2_sbd *rd_sbd;
struct gfs2_rgrp_lvb *rd_rgl;
u32 rd_last_alloc;
u32 rd_flags;
u32 rd_extfail_pt; /* extent failure point */
#define GFS2_RDF_CHECK 0x10000000 /* check for unlinked inodes */
#define GFS2_RDF_ERROR 0x40000000 /* error in rg */
#define GFS2_RDF_PREFERRED 0x80000000 /* This rgrp is preferred */
#define GFS2_RDF_MASK 0xf0000000 /* mask for internal flags */
spinlock_t rd_rsspin; /* protects reservation related vars */
struct mutex rd_mutex;
struct rb_root rd_rstree; /* multi-block reservation tree */
};
Annotation
- Immediate include surface: `linux/fs.h`, `linux/kobject.h`, `linux/workqueue.h`, `linux/dlm.h`, `linux/buffer_head.h`, `linux/rcupdate.h`, `linux/rculist_bl.h`, `linux/completion.h`.
- Detected declarations: `struct gfs2_log_operations`, `struct gfs2_bufdata`, `struct gfs2_holder`, `struct gfs2_glock`, `struct gfs2_quota_data`, `struct gfs2_trans`, `struct gfs2_jdesc`, `struct gfs2_sbd`, `struct lm_lockops`, `struct gfs2_log_header_host`.
- 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.