fs/ocfs2/inode.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/inode.c- Extension
.c- Size
- 58883 bytes
- Lines
- 2018
- 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/types.hlinux/highmem.hlinux/pagemap.hlinux/quotaops.hlinux/iversion.hlinux/fs_dirent.hasm/byteorder.hcluster/masklog.hocfs2.halloc.hdir.hblockcheck.hdlmglue.hextent_map.hfile.hheartbeat.hinode.hjournal.hnamei.hsuballoc.hsuper.hsymlink.hsysfile.huptodate.hxattr.hrefcounttree.hocfs2_trace.hfilecheck.hbuffer_head_io.h
Detected Declarations
struct ocfs2_find_inode_argsfunction ocfs2_valid_inode_modefunction ocfs2_dinode_has_unexpected_rdevfunction ocfs2_dinode_has_size_without_clustersfunction ocfs2_set_inode_flagsfunction ocfs2_get_inode_flagsfunction ocfs2_dinode_has_extentsfunction ocfs2_find_actorfunction ocfs2_init_locked_inodefunction ocfs2_populate_inodefunction ocfs2_read_locked_inodefunction ocfs2_sync_blockdevfunction ocfs2_truncate_for_deletefunction ocfs2_remove_inodefunction igetfunction ocfs2_signal_wipe_completionfunction ocfs2_wipe_inodefunction ocfs2_inode_is_valid_to_deletefunction ocfs2_query_inode_wipefunction ocfs2_cleanup_delete_inodefunction ocfs2_delete_inodefunction ocfs2_clear_inodefunction ocfs2_evict_inodefunction ocfs2_inode_revalidatefunction ocfs2_mark_inode_dirtyfunction ocfs2_refresh_inodefunction ocfs2_validate_inode_blockfunction init_special_inodefunction ocfs2_filecheck_validate_inode_blockfunction ocfs2_filecheck_repair_inode_blockfunction ocfs2_filecheck_read_inode_block_fullfunction ocfs2_read_inode_block_fullfunction ocfs2_read_inode_blockfunction ocfs2_inode_cache_ownerfunction ocfs2_inode_cache_lockfunction ocfs2_inode_cache_unlockfunction ocfs2_inode_cache_io_lockfunction ocfs2_inode_cache_io_unlock
Annotated Snippet
if (status) {
make_bad_inode(inode);
mlog_errno(status);
return status;
}
status = ocfs2_inode_lock(inode, NULL, lock_level);
if (status) {
make_bad_inode(inode);
mlog_errno(status);
return status;
}
}
if (args->fi_flags & OCFS2_FI_FLAG_ORPHAN_RECOVERY) {
status = ocfs2_try_open_lock(inode, 0);
if (status) {
make_bad_inode(inode);
return status;
}
}
if (can_lock) {
if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_CHK)
status = ocfs2_filecheck_read_inode_block_full(inode,
&bh, OCFS2_BH_IGNORE_CACHE, 0);
else if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_FIX)
status = ocfs2_filecheck_read_inode_block_full(inode,
&bh, OCFS2_BH_IGNORE_CACHE, 1);
else
status = ocfs2_read_inode_block_full(inode,
&bh, OCFS2_BH_IGNORE_CACHE);
} else {
status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh);
/*
* If buffer is in jbd, then its checksum may not have been
* computed as yet.
*/
if (!status && !buffer_jbd(bh)) {
if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_CHK)
status = ocfs2_filecheck_validate_inode_block(
osb->sb, bh);
else if (args->fi_flags & OCFS2_FI_FLAG_FILECHECK_FIX)
status = ocfs2_filecheck_repair_inode_block(
osb->sb, bh);
else
status = ocfs2_validate_inode_block(
osb->sb, bh);
}
}
if (status < 0) {
mlog_errno(status);
goto bail;
}
status = -EINVAL;
fe = (struct ocfs2_dinode *) bh->b_data;
/*
* This is a code bug. Right now the caller needs to
* understand whether it is asking for a system file inode or
* not so the proper lock names can be built.
*/
mlog_bug_on_msg(!!(fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) !=
!!(args->fi_flags & OCFS2_FI_FLAG_SYSFILE),
"Inode %llu: system file state is ambiguous\n",
(unsigned long long)args->fi_blkno);
if (S_ISCHR(le16_to_cpu(fe->i_mode)) ||
S_ISBLK(le16_to_cpu(fe->i_mode)))
inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
ocfs2_populate_inode(inode, fe, 0);
BUG_ON(args->fi_blkno != le64_to_cpu(fe->i_blkno));
if (buffer_dirty(bh) && !buffer_jbd(bh)) {
if (can_lock) {
ocfs2_inode_unlock(inode, lock_level);
lock_level = 1;
ocfs2_inode_lock(inode, NULL, lock_level);
}
status = ocfs2_write_block(osb, bh, INODE_CACHE(inode));
if (status < 0) {
mlog_errno(status);
goto bail;
}
}
status = 0;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/types.h`, `linux/highmem.h`, `linux/pagemap.h`, `linux/quotaops.h`, `linux/iversion.h`, `linux/fs_dirent.h`, `asm/byteorder.h`.
- Detected declarations: `struct ocfs2_find_inode_args`, `function ocfs2_valid_inode_mode`, `function ocfs2_dinode_has_unexpected_rdev`, `function ocfs2_dinode_has_size_without_clusters`, `function ocfs2_set_inode_flags`, `function ocfs2_get_inode_flags`, `function ocfs2_dinode_has_extents`, `function ocfs2_find_actor`, `function ocfs2_init_locked_inode`, `function ocfs2_populate_inode`.
- 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.