fs/ufs/cylinder.c
Source file repositories/reference/linux-study-clean/fs/ufs/cylinder.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ufs/cylinder.c- Extension
.c- Size
- 6002 bytes
- Lines
- 208
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/time.hlinux/stat.hlinux/string.hlinux/bitops.hasm/byteorder.hufs_fs.hufs.hswab.hutil.h
Detected Declarations
function Copyrightfunction groupfunction ufs_load_cylinder
Annotated Snippet
if (sbi->s_cgno[cgno] != UFS_CGNO_EMPTY) {
if (sbi->s_cgno[cgno] != cgno) {
ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache");
UFSD("EXIT (FAILED)\n");
return NULL;
}
} else {
if (unlikely(!ufs_read_cylinder (sb, cgno, cgno))) {
UFSD("EXIT (FAILED)\n");
return NULL;
}
}
UFSD("EXIT\n");
return sbi->s_ucpi[cgno];
}
/*
* Cylinder group number cg is in cache but it was not last used,
* we will move to the first position
*/
for (i = 0; i < sbi->s_cg_loaded && sbi->s_cgno[i] != cgno; i++);
if (i < sbi->s_cg_loaded && sbi->s_cgno[i] == cgno) {
cg = sbi->s_cgno[i];
ucpi = sbi->s_ucpi[i];
for (j = i; j > 0; j--) {
sbi->s_cgno[j] = sbi->s_cgno[j-1];
sbi->s_ucpi[j] = sbi->s_ucpi[j-1];
}
sbi->s_cgno[0] = cg;
sbi->s_ucpi[0] = ucpi;
/*
* Cylinder group number cg is not in cache, we will read it from disk
* and put it to the first position
*/
} else {
if (sbi->s_cg_loaded < UFS_MAX_GROUP_LOADED)
sbi->s_cg_loaded++;
else
ufs_put_cylinder (sb, UFS_MAX_GROUP_LOADED-1);
ucpi = sbi->s_ucpi[sbi->s_cg_loaded - 1];
for (j = sbi->s_cg_loaded - 1; j > 0; j--) {
sbi->s_cgno[j] = sbi->s_cgno[j-1];
sbi->s_ucpi[j] = sbi->s_ucpi[j-1];
}
sbi->s_ucpi[0] = ucpi;
if (unlikely(!ufs_read_cylinder (sb, cgno, 0))) {
UFSD("EXIT (FAILED)\n");
return NULL;
}
}
UFSD("EXIT\n");
return sbi->s_ucpi[0];
}
Annotation
- Immediate include surface: `linux/fs.h`, `linux/time.h`, `linux/stat.h`, `linux/string.h`, `linux/bitops.h`, `asm/byteorder.h`, `ufs_fs.h`, `ufs.h`.
- Detected declarations: `function Copyright`, `function group`, `function ufs_load_cylinder`.
- 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.