fs/xfs/xfs_log_priv.h
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_log_priv.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_log_priv.h- Extension
.h- Size
- 27367 bytes
- Lines
- 748
- 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
xfs_extent_busy.h
Detected Declarations
struct xfs_bufstruct xlogstruct xlog_ticketstruct xfs_mountstruct xfs_log_iovecstruct xfs_log_vecstruct xlog_ticketstruct xlog_in_corestruct xfs_cilstruct xfs_cil_ctxstruct xlog_cil_pcpstruct xfs_cilstruct xlog_grant_headstruct xlogenum xlog_iclog_statefunction xlog_get_client_idfunction xlog_recovery_neededfunction xlog_in_recoveryfunction xlog_is_shutdownfunction xlog_force_shutdownfunction xlog_crack_atomic_lsnfunction xlog_assign_atomic_lsnfunction xlog_cil_forcefunction xlog_waitfunction xlog_lsn_subfunction xlog_valid_lsnfunction kmallocfunction xlog_item_space
Annotated Snippet
struct xfs_log_iovec {
void *i_addr;/* beginning address of region */
int i_len; /* length in bytes of region */
uint i_type; /* type of region */
};
struct xfs_log_vec {
struct list_head lv_list; /* CIL lv chain ptrs */
uint32_t lv_order_id; /* chain ordering info */
int lv_niovecs; /* number of iovecs in lv */
struct xfs_log_iovec *lv_iovecp; /* iovec array */
struct xfs_log_item *lv_item; /* owner */
char *lv_buf; /* formatted buffer */
int lv_bytes; /* accounted space in buffer */
int lv_buf_used; /* buffer space used so far */
int lv_alloc_size; /* size of allocated lv */
};
/*
* get client id from packed copy.
*
* this hack is here because the xlog_pack code copies four bytes
* of xlog_op_header containing the fields oh_clientid, oh_flags
* and oh_res2 into the packed copy.
*
* later on this four byte chunk is treated as an int and the
* client id is pulled out.
*
* this has endian issues, of course.
*/
static inline uint xlog_get_client_id(__be32 i)
{
return be32_to_cpu(i) >> 24;
}
/*
* In core log state
*/
enum xlog_iclog_state {
XLOG_STATE_ACTIVE, /* Current IC log being written to */
XLOG_STATE_WANT_SYNC, /* Want to sync this iclog; no more writes */
XLOG_STATE_SYNCING, /* This IC log is syncing */
XLOG_STATE_DONE_SYNC, /* Done syncing to disk */
XLOG_STATE_CALLBACK, /* Callback functions now */
XLOG_STATE_DIRTY, /* Dirty IC log, not ready for ACTIVE status */
};
#define XLOG_STATE_STRINGS \
{ XLOG_STATE_ACTIVE, "XLOG_STATE_ACTIVE" }, \
{ XLOG_STATE_WANT_SYNC, "XLOG_STATE_WANT_SYNC" }, \
{ XLOG_STATE_SYNCING, "XLOG_STATE_SYNCING" }, \
{ XLOG_STATE_DONE_SYNC, "XLOG_STATE_DONE_SYNC" }, \
{ XLOG_STATE_CALLBACK, "XLOG_STATE_CALLBACK" }, \
{ XLOG_STATE_DIRTY, "XLOG_STATE_DIRTY" }
/*
* In core log flags
*/
#define XLOG_ICL_NEED_FLUSH (1u << 0) /* iclog needs REQ_PREFLUSH */
#define XLOG_ICL_NEED_FUA (1u << 1) /* iclog needs REQ_FUA */
#define XLOG_ICL_STRINGS \
{ XLOG_ICL_NEED_FLUSH, "XLOG_ICL_NEED_FLUSH" }, \
{ XLOG_ICL_NEED_FUA, "XLOG_ICL_NEED_FUA" }
/*
* Log ticket flags
*/
#define XLOG_TIC_PERM_RESERV (1u << 0) /* permanent reservation */
#define XLOG_TIC_FLAGS \
{ XLOG_TIC_PERM_RESERV, "XLOG_TIC_PERM_RESERV" }
/*
* Below are states for covering allocation transactions.
* By covering, we mean changing the h_tail_lsn in the last on-disk
* log write such that no allocation transactions will be re-done during
* recovery after a system crash. Recovery starts at the last on-disk
* log write.
*
* These states are used to insert dummy log entries to cover
* space allocation transactions which can undo non-transactional changes
* after a crash. Writes to a file with space
* already allocated do not result in any transactions. Allocations
* might include space beyond the EOF. So if we just push the EOF a
* little, the last transaction for the file could contain the wrong
* size. If there is no file system activity, after an allocation
* transaction, and the system crashes, the allocation transaction
* will get replayed and the file will be truncated. This could
Annotation
- Immediate include surface: `xfs_extent_busy.h`.
- Detected declarations: `struct xfs_buf`, `struct xlog`, `struct xlog_ticket`, `struct xfs_mount`, `struct xfs_log_iovec`, `struct xfs_log_vec`, `struct xlog_ticket`, `struct xlog_in_core`, `struct xfs_cil`, `struct xfs_cil_ctx`.
- 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.