fs/f2fs/namei.c
Source file repositories/reference/linux-study-clean/fs/f2fs/namei.c
File Facts
- System
- Linux kernel
- Corpus path
fs/f2fs/namei.c- Extension
.c- Size
- 34190 bytes
- Lines
- 1403
- 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/fs.hlinux/f2fs_fs.hlinux/pagemap.hlinux/sched.hlinux/ctype.hlinux/random.hlinux/dcache.hlinux/namei.hlinux/quotaops.hf2fs.hnode.hsegment.hxattr.hacl.htrace/events/f2fs.h
Detected Declarations
function Copyrightfunction is_temperature_extensionfunction is_compress_extensionfunction f2fs_update_extension_listfunction set_compress_new_inodefunction set_file_temperaturefunction f2fs_has_inline_dentryfunction f2fs_createfunction f2fs_linkfunction f2fs_unlinkfunction f2fs_symlinkfunction f2fs_rmdirfunction f2fs_mknodfunction __f2fs_tmpfilefunction f2fs_tmpfilefunction f2fs_create_whiteoutfunction f2fs_get_tmpfilefunction f2fs_renamefunction f2fs_cross_renamefunction f2fs_rename2function f2fs_encrypted_symlink_getattr
Annotated Snippet
if (!strncasecmp(s + i + 1, sub, sublen)) {
if (!tmp_dot)
return true;
if (i == slen - sublen - 1 || s[i + 1 + sublen] == '.')
return true;
}
}
return false;
}
static inline bool is_temperature_extension(const unsigned char *s, const char *sub)
{
return is_extension_exist(s, sub, true, false);
}
static inline bool is_compress_extension(const unsigned char *s, const char *sub)
{
return is_extension_exist(s, sub, true, true);
}
int f2fs_update_extension_list(struct f2fs_sb_info *sbi, const char *name,
bool hot, bool set)
{
__u8 (*extlist)[F2FS_EXTENSION_LEN] = sbi->raw_super->extension_list;
int cold_count = le32_to_cpu(sbi->raw_super->extension_count);
int hot_count = sbi->raw_super->hot_ext_count;
int total_count = cold_count + hot_count;
int start, count;
int i;
if (set) {
if (total_count == F2FS_MAX_EXTENSION)
return -EINVAL;
if (hot) {
start = 0;
count = cold_count;
} else {
start = cold_count;
count = total_count;
}
for (i = start; i < count; i++) {
if (!strcmp(name, extlist[i])) {
f2fs_warn(sbi, "extension '%s' already exists in %s list",
name, hot ? "cold" : "hot");
return -EINVAL;
}
}
} else {
if (!hot && !cold_count)
return -EINVAL;
if (hot && !hot_count)
return -EINVAL;
}
if (hot) {
start = cold_count;
count = total_count;
} else {
start = 0;
count = cold_count;
}
for (i = start; i < count; i++) {
if (strcmp(name, extlist[i]))
continue;
if (set)
return -EINVAL;
memcpy(extlist[i], extlist[i + 1],
F2FS_EXTENSION_LEN * (total_count - i - 1));
memset(extlist[total_count - 1], 0, F2FS_EXTENSION_LEN);
if (hot)
sbi->raw_super->hot_ext_count = hot_count - 1;
else
sbi->raw_super->extension_count =
cpu_to_le32(cold_count - 1);
return 0;
}
if (!set)
return -EINVAL;
if (hot) {
memcpy(extlist[count], name, strlen(name));
sbi->raw_super->hot_ext_count = hot_count + 1;
} else {
char buf[F2FS_MAX_EXTENSION][F2FS_EXTENSION_LEN];
Annotation
- Immediate include surface: `linux/fs.h`, `linux/f2fs_fs.h`, `linux/pagemap.h`, `linux/sched.h`, `linux/ctype.h`, `linux/random.h`, `linux/dcache.h`, `linux/namei.h`.
- Detected declarations: `function Copyright`, `function is_temperature_extension`, `function is_compress_extension`, `function f2fs_update_extension_list`, `function set_compress_new_inode`, `function set_file_temperature`, `function f2fs_has_inline_dentry`, `function f2fs_create`, `function f2fs_link`, `function f2fs_unlink`.
- 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.