fs/exfat/inode.c
Source file repositories/reference/linux-study-clean/fs/exfat/inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/exfat/inode.c- Extension
.c- Size
- 12411 bytes
- Lines
- 461
- 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/init.hlinux/buffer_head.hlinux/mpage.hlinux/bio.hlinux/blkdev.hlinux/time.hlinux/writeback.hlinux/uio.hlinux/random.hlinux/iversion.hlinux/iomap.hexfat_raw.hexfat_fs.hiomap.h
Detected Declarations
function Copyrightfunction exfat_write_inodefunction exfat_sync_inodefunction exfat_map_clusterfunction exfat_read_foliofunction exfat_readaheadfunction exfat_writepagesfunction exfat_aop_bmapfunction exfat_hashfunction exfat_hash_inodefunction exfat_unhash_inodefunction exfat_fill_inodefunction exfat_evict_inode
Annotated Snippet
if (clu_offset < num_clusters) {
*clu += clu_offset;
*count = min(num_clusters - clu_offset, *count);
} else {
*clu = EXFAT_EOF_CLUSTER;
*count = 0;
}
} else {
int err = exfat_get_cluster(inode, clu_offset,
clu, count, &last_clu);
if (err)
return -EIO;
}
if (*clu == EXFAT_EOF_CLUSTER) {
exfat_set_volume_dirty(sb);
new_clu.dir = (last_clu == EXFAT_EOF_CLUSTER) ?
EXFAT_EOF_CLUSTER : last_clu + 1;
new_clu.size = 0;
new_clu.flags = ei->flags;
/* allocate a cluster */
if (num_to_be_allocated < 1) {
/* Broken FAT (i_sze > allocated FAT) */
exfat_fs_error(sb, "broken FAT chain.");
return -EIO;
}
ret = exfat_alloc_cluster(inode, num_to_be_allocated, &new_clu,
inode_needs_sync(inode), true);
if (ret)
return ret;
if (new_clu.dir == EXFAT_EOF_CLUSTER ||
new_clu.dir == EXFAT_FREE_CLUSTER) {
exfat_fs_error(sb,
"bogus cluster new allocated (last_clu : %u, new_clu : %u)",
last_clu, new_clu.dir);
return -EIO;
}
/* append to the FAT chain */
if (last_clu == EXFAT_EOF_CLUSTER) {
if (new_clu.flags == ALLOC_FAT_CHAIN)
ei->flags = ALLOC_FAT_CHAIN;
ei->start_clu = new_clu.dir;
} else {
if (new_clu.flags != ei->flags) {
/* no-fat-chain bit is disabled,
* so fat-chain should be synced with
* alloc-bitmap
*/
if (exfat_chain_cont_cluster(sb, ei->start_clu,
num_clusters))
return -EIO;
ei->flags = ALLOC_FAT_CHAIN;
}
if (new_clu.flags == ALLOC_FAT_CHAIN)
if (exfat_ent_set(sb, last_clu, new_clu.dir))
return -EIO;
}
*clu = new_clu.dir;
*count = new_clu.size;
inode->i_blocks += exfat_cluster_to_sectors(sbi, new_clu.size);
if (balloc)
*balloc = true;
}
/* hint information */
ei->hint_bmap.off = local_clu_offset;
ei->hint_bmap.clu = *clu;
return 0;
}
static int exfat_read_folio(struct file *file, struct folio *folio)
{
struct iomap_read_folio_ctx ctx = {
.cur_folio = folio,
.ops = &exfat_iomap_bio_read_ops,
};
iomap_read_folio(&exfat_iomap_ops, &ctx, NULL);
return 0;
}
static void exfat_readahead(struct readahead_control *rac)
Annotation
- Immediate include surface: `linux/init.h`, `linux/buffer_head.h`, `linux/mpage.h`, `linux/bio.h`, `linux/blkdev.h`, `linux/time.h`, `linux/writeback.h`, `linux/uio.h`.
- Detected declarations: `function Copyright`, `function exfat_write_inode`, `function exfat_sync_inode`, `function exfat_map_cluster`, `function exfat_read_folio`, `function exfat_readahead`, `function exfat_writepages`, `function exfat_aop_bmap`, `function exfat_hash`, `function exfat_hash_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.