fs/ntfs3/fsntfs.c
Source file repositories/reference/linux-study-clean/fs/ntfs3/fsntfs.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ntfs3/fsntfs.c- Extension
.c- Size
- 59440 bytes
- Lines
- 2705
- 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/blkdev.hlinux/buffer_head.hlinux/fs.hlinux/kernel.hlinux/nls.hdebug.hntfs.hntfs_fs.h
Detected Declarations
function ntfs_fix_pre_writefunction ntfs_fix_post_readfunction ntfs_extend_initfunction ntfs_loadlog_and_replayfunction ntfs_look_for_free_spacefunction ntfs_check_free_spacefunction ntfs_extend_mftfunction ntfs_look_free_mftfunction ntfs_mark_rec_freefunction ntfs_clear_mft_tailfunction ntfs_refresh_zonefunction ntfs_update_mftmirrfunction ntfs_bad_inodefunction ntfs_set_statefunction security_hashfunction ntfs_sb_writefunction ntfs_sb_write_runfunction ntfs_read_run_nb_rafunction ntfs_read_bh_rafunction ntfs_get_bhfunction ntfs_write_bhfunction ntfs_read_write_runfunction ntfs_bio_fill_1function ntfs_vbo_to_lbofunction sid_lengthfunction is_acl_validfunction is_sd_validfunction ntfs_security_initfunction offsetoffunction offsetoffunction ntfs_get_security_by_idfunction locationfunction ntfs_reparse_initfunction ntfs_objid_initfunction ntfs_objid_removefunction ntfs_insert_reparsefunction ntfs_remove_reparsefunction ntfs_unmap_and_discardfunction mark_as_free_exfunction run_deallocatefunction name_has_forbidden_charsfunction is_reserved_namefunction valid_windows_namefunction ntfs_set_label
Annotated Snippet
if (*ptr != sample) {
/* Fixup does not match! Is it serious error? */
ret = -E_NTFS_FIXUP;
}
/* Replace fixup. */
*ptr = *++fixup;
ptr += SECTOR_SIZE / sizeof(short);
}
return ret;
}
/*
* ntfs_extend_init - Load $Extend file.
*/
int ntfs_extend_init(struct ntfs_sb_info *sbi)
{
int err;
struct super_block *sb = sbi->sb;
struct inode *inode, *inode2;
struct MFT_REF ref;
if (sbi->volume.major_ver < 3) {
ntfs_notice(sb, "Skip $Extend 'cause NTFS version");
return 0;
}
ref.low = cpu_to_le32(MFT_REC_EXTEND);
ref.high = 0;
ref.seq = cpu_to_le16(MFT_REC_EXTEND);
inode = ntfs_iget5(sb, &ref, &NAME_EXTEND);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
ntfs_err(sb, "Failed to load $Extend (%d).", err);
inode = NULL;
goto out;
}
/* If ntfs_iget5() reads from disk it never returns bad inode. */
if (!S_ISDIR(inode->i_mode)) {
err = -EINVAL;
goto out;
}
/* Try to find $ObjId */
inode2 = dir_search_u(inode, &NAME_OBJID, NULL);
if (inode2 && !IS_ERR(inode2)) {
if (is_bad_inode(inode2)) {
iput(inode2);
} else {
sbi->objid.ni = ntfs_i(inode2);
sbi->objid_no = inode2->i_ino;
}
}
/* Try to find $Quota */
inode2 = dir_search_u(inode, &NAME_QUOTA, NULL);
if (inode2 && !IS_ERR(inode2)) {
sbi->quota_no = inode2->i_ino;
iput(inode2);
}
/* Try to find $Reparse */
inode2 = dir_search_u(inode, &NAME_REPARSE, NULL);
if (inode2 && !IS_ERR(inode2)) {
sbi->reparse.ni = ntfs_i(inode2);
sbi->reparse_no = inode2->i_ino;
}
/* Try to find $UsnJrnl */
inode2 = dir_search_u(inode, &NAME_USNJRNL, NULL);
if (inode2 && !IS_ERR(inode2)) {
sbi->usn_jrnl_no = inode2->i_ino;
iput(inode2);
}
err = 0;
out:
iput(inode);
return err;
}
int ntfs_loadlog_and_replay(struct ntfs_inode *ni, struct ntfs_sb_info *sbi)
{
int err = 0;
struct super_block *sb = sbi->sb;
bool initialized = false;
struct MFT_REF ref;
struct inode *inode;
Annotation
- Immediate include surface: `linux/blkdev.h`, `linux/buffer_head.h`, `linux/fs.h`, `linux/kernel.h`, `linux/nls.h`, `debug.h`, `ntfs.h`, `ntfs_fs.h`.
- Detected declarations: `function ntfs_fix_pre_write`, `function ntfs_fix_post_read`, `function ntfs_extend_init`, `function ntfs_loadlog_and_replay`, `function ntfs_look_for_free_space`, `function ntfs_check_free_space`, `function ntfs_extend_mft`, `function ntfs_look_free_mft`, `function ntfs_mark_rec_free`, `function ntfs_clear_mft_tail`.
- 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.