fs/ntfs3/fslog.c
Source file repositories/reference/linux-study-clean/fs/ntfs3/fslog.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ntfs3/fslog.c- Extension
.c- Size
- 125856 bytes
- Lines
- 5248
- 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.
- 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/blkdev.hlinux/fs.hlinux/random.hlinux/slab.hdebug.hntfs.hntfs_fs.h
Detected Declarations
struct RESTART_HDRstruct CLIENT_RECstruct RESTART_AREAstruct LOG_REC_HDRstruct RESTART_TABLEstruct ATTR_NAME_ENTRYstruct OPEN_ATTR_ENRTYstruct OPEN_ATTR_ENRTY_32struct DIR_PAGE_ENTRYstruct DIR_PAGE_ENTRY_32struct TRANSACTION_ENTRYstruct NTFS_RESTARTstruct NEW_ATTRIBUTE_SIZESstruct BITMAP_RANGEstruct LCN_RANGEstruct CLIENT_IDstruct LFS_RECORD_HDRstruct LFS_RECORDstruct RECORD_PAGE_HDRstruct lcbstruct restart_infostruct ntfs_logstruct OpenAttrenum transact_stateenum NTFS_LOG_OPERATIONfunction is_log_record_endfunction is_target_requiredfunction can_skip_actionfunction bytes_per_rtfunction lrh_lengthfunction lcb_putfunction oldest_client_lsnfunction is_rst_page_hdr_validfunction is_rst_area_validfunction is_client_area_validfunction remove_clientfunction add_clientfunction norm_file_pagefunction check_log_recfunction check_rstblfunction free_rsttbl_idxfunction lsn_to_vbofunction next_page_offfunction lsn_to_page_offfunction vbo_to_lsnfunction is_lsn_in_filefunction hdr_file_offfunction base_lsn
Annotated Snippet
struct RESTART_HDR {
struct NTFS_RECORD_HEADER rhdr; // 'RSTR'
__le32 sys_page_size; // 0x10: Page size of the system which initialized the log.
__le32 page_size; // 0x14: Log page size used for this log file.
__le16 ra_off; // 0x18:
__le16 minor_ver; // 0x1A:
__le16 major_ver; // 0x1C:
__le16 fixups[];
};
#define LFS_NO_CLIENT 0xffff
#define LFS_NO_CLIENT_LE cpu_to_le16(0xffff)
struct CLIENT_REC {
__le64 oldest_lsn;
__le64 restart_lsn; // 0x08:
__le16 prev_client; // 0x10:
__le16 next_client; // 0x12:
__le16 seq_num; // 0x14:
u8 align[6]; // 0x16:
__le32 name_bytes; // 0x1C: In bytes.
__le16 name[64]; // 0x20: Name of client.
};
static_assert(sizeof(struct CLIENT_REC) == 0xa0);
/* Two copies of these will exist at the beginning of the log file */
struct RESTART_AREA {
__le64 current_lsn; // 0x00: Current logical end of log file.
__le16 log_clients; // 0x08: Maximum number of clients.
__le16 client_idx[2]; // 0x0A: Free/use index into the client record arrays.
__le16 flags; // 0x0E: See RESTART_SINGLE_PAGE_IO.
__le32 seq_num_bits; // 0x10: The number of bits in sequence number.
__le16 ra_len; // 0x14:
__le16 client_off; // 0x16:
__le64 l_size; // 0x18: Usable log file size.
__le32 last_lsn_data_len; // 0x20:
__le16 rec_hdr_len; // 0x24: Log page data offset.
__le16 data_off; // 0x26: Log page data length.
__le32 open_log_count; // 0x28:
__le32 align[5]; // 0x2C:
struct CLIENT_REC clients[]; // 0x40:
};
struct LOG_REC_HDR {
__le16 redo_op; // 0x00: NTFS_LOG_OPERATION
__le16 undo_op; // 0x02: NTFS_LOG_OPERATION
__le16 redo_off; // 0x04: Offset to Redo record.
__le16 redo_len; // 0x06: Redo length.
__le16 undo_off; // 0x08: Offset to Undo record.
__le16 undo_len; // 0x0A: Undo length.
__le16 target_attr; // 0x0C:
__le16 lcns_follow; // 0x0E:
__le16 record_off; // 0x10:
__le16 attr_off; // 0x12:
__le16 cluster_off; // 0x14:
__le16 reserved; // 0x16:
__le64 target_vcn; // 0x18:
__le64 page_lcns[]; // 0x20:
};
static_assert(sizeof(struct LOG_REC_HDR) == 0x20);
#define RESTART_ENTRY_ALLOCATED 0xFFFFFFFF
#define RESTART_ENTRY_ALLOCATED_LE cpu_to_le32(0xFFFFFFFF)
struct RESTART_TABLE {
__le16 size; // 0x00: In bytes
__le16 used; // 0x02: Entries
__le16 total; // 0x04: Entries
__le16 res[3]; // 0x06:
__le32 free_goal; // 0x0C:
__le32 first_free; // 0x10:
__le32 last_free; // 0x14:
};
static_assert(sizeof(struct RESTART_TABLE) == 0x18);
struct ATTR_NAME_ENTRY {
__le16 off; // Offset in the Open attribute Table.
__le16 name_bytes;
__le16 name[];
};
struct OPEN_ATTR_ENRTY {
__le32 next; // 0x00: RESTART_ENTRY_ALLOCATED if allocated
__le32 bytes_per_index; // 0x04:
enum ATTR_TYPE type; // 0x08:
u8 is_dirty_pages; // 0x0C:
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/fs.h`, `linux/random.h`, `linux/slab.h`, `debug.h`, `ntfs.h`, `ntfs_fs.h`.
- Detected declarations: `struct RESTART_HDR`, `struct CLIENT_REC`, `struct RESTART_AREA`, `struct LOG_REC_HDR`, `struct RESTART_TABLE`, `struct ATTR_NAME_ENTRY`, `struct OPEN_ATTR_ENRTY`, `struct OPEN_ATTR_ENRTY_32`, `struct DIR_PAGE_ENTRY`, `struct DIR_PAGE_ENTRY_32`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
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.