fs/ocfs2/ioctl.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/ioctl.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/ioctl.c- Extension
.c- Size
- 23080 bytes
- Lines
- 1004
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/mount.hlinux/blkdev.hlinux/compat.hlinux/fileattr.hcluster/masklog.hocfs2.halloc.hdlmglue.hfile.hinode.hjournal.hocfs2_fs.hioctl.hresize.hrefcounttree.hsysfile.hdir.hbuffer_head_io.hsuballoc.hmove_extents.h
Detected Declarations
function Copyrightfunction o2info_set_request_filledfunction o2info_clear_request_filledfunction o2info_coherentfunction ocfs2_fileattr_getfunction ocfs2_fileattr_setfunction ocfs2_info_handle_blocksizefunction ocfs2_info_handle_clustersizefunction ocfs2_info_handle_maxslotsfunction ocfs2_info_handle_labelfunction ocfs2_info_handle_uuidfunction ocfs2_info_handle_fs_featuresfunction ocfs2_info_handle_journal_sizefunction ocfs2_info_scan_inode_allocfunction ocfs2_info_handle_freeinodefunction o2ffg_update_histogramfunction o2ffg_update_statsfunction ocfs2_info_update_ffgfunction ocfs2_info_freefrag_scan_chainfunction ocfs2_read_group_descriptorfunction ocfs2_info_freefrag_scan_bitmapfunction Chunksizefunction ocfs2_info_handle_freefragfunction ocfs2_info_handle_unknownfunction ocfs2_info_handle_requestfunction ocfs2_get_request_ptrfunction ocfs2_info_handlefunction ocfs2_ioctlfunction ocfs2_compat_ioctl
Annotated Snippet
if (status < 0) {
mlog_errno(status);
goto bail;
}
unlock = 1;
} else {
status = ocfs2_read_blocks_sync(osb, blkno, 1, &bh);
if (status < 0) {
mlog_errno(status);
goto bail;
}
}
dinode_alloc = (struct ocfs2_dinode *)bh->b_data;
fi->ifi_stat[slot].lfi_total =
le32_to_cpu(dinode_alloc->id1.bitmap1.i_total);
fi->ifi_stat[slot].lfi_free =
le32_to_cpu(dinode_alloc->id1.bitmap1.i_total) -
le32_to_cpu(dinode_alloc->id1.bitmap1.i_used);
bail:
if (unlock)
ocfs2_inode_unlock(inode_alloc, 0);
if (inode_alloc)
inode_unlock(inode_alloc);
brelse(bh);
return status;
}
static int ocfs2_info_handle_freeinode(struct inode *inode,
struct ocfs2_info_request __user *req)
{
u32 i;
u64 blkno = -1;
char namebuf[40];
int status, type = INODE_ALLOC_SYSTEM_INODE;
struct ocfs2_info_freeinode *oifi = NULL;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct inode *inode_alloc = NULL;
oifi = kzalloc_obj(struct ocfs2_info_freeinode);
if (!oifi) {
status = -ENOMEM;
mlog_errno(status);
goto out_err;
}
if (o2info_from_user(*oifi, req)) {
status = -EFAULT;
goto out_free;
}
oifi->ifi_slotnum = osb->max_slots;
for (i = 0; i < oifi->ifi_slotnum; i++) {
if (o2info_coherent(&oifi->ifi_req)) {
inode_alloc = ocfs2_get_system_file_inode(osb, type, i);
if (!inode_alloc) {
mlog(ML_ERROR, "unable to get alloc inode in "
"slot %u\n", i);
status = -EIO;
goto bail;
}
} else {
int len = ocfs2_sprintf_system_inode_name(namebuf,
sizeof(namebuf),
type, i);
status = ocfs2_lookup_ino_from_name(osb->sys_root_inode,
namebuf, len, &blkno);
if (status < 0) {
status = -ENOENT;
goto bail;
}
}
status = ocfs2_info_scan_inode_alloc(osb, inode_alloc, blkno, oifi, i);
iput(inode_alloc);
inode_alloc = NULL;
if (status < 0)
goto bail;
}
o2info_set_request_filled(&oifi->ifi_req);
Annotation
- Immediate include surface: `linux/fs.h`, `linux/mount.h`, `linux/blkdev.h`, `linux/compat.h`, `linux/fileattr.h`, `cluster/masklog.h`, `ocfs2.h`, `alloc.h`.
- Detected declarations: `function Copyright`, `function o2info_set_request_filled`, `function o2info_clear_request_filled`, `function o2info_coherent`, `function ocfs2_fileattr_get`, `function ocfs2_fileattr_set`, `function ocfs2_info_handle_blocksize`, `function ocfs2_info_handle_clustersize`, `function ocfs2_info_handle_maxslots`, `function ocfs2_info_handle_label`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.