fs/xfs/xfs_export.c
Source file repositories/reference/linux-study-clean/fs/xfs/xfs_export.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/xfs_export.c- Extension
.c- Size
- 6291 bytes
- Lines
- 250
- 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
xfs_platform.hxfs_shared.hxfs_format.hxfs_log_format.hxfs_trans_resv.hxfs_mount.hxfs_dir2.hxfs_export.hxfs_inode.hxfs_trans.hxfs_inode_item.hxfs_icache.hxfs_pnfs.h
Detected Declarations
function Copyrightfunction xfs_fs_encode_fhfunction xfs_nfs_get_inodefunction xfs_fs_fh_to_dentryfunction xfs_fs_fh_to_parentfunction xfs_fs_get_parentfunction xfs_fs_nfs_commit_metadata
Annotated Snippet
switch (error) {
case -EINVAL:
case -ENOENT:
case -EFSCORRUPTED:
error = -ESTALE;
break;
default:
break;
}
return ERR_PTR(error);
}
/*
* Reload the incore unlinked list to avoid failure in inodegc.
* Use an unlocked check here because unrecovered unlinked inodes
* should be somewhat rare.
*/
if (xfs_inode_unlinked_incomplete(ip)) {
error = xfs_inode_reload_unlinked(ip);
if (error) {
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
xfs_irele(ip);
return ERR_PTR(error);
}
}
if (VFS_I(ip)->i_generation != generation || IS_PRIVATE(VFS_I(ip))) {
xfs_irele(ip);
return ERR_PTR(-ESTALE);
}
return VFS_I(ip);
}
STATIC struct dentry *
xfs_fs_fh_to_dentry(struct super_block *sb, struct fid *fid,
int fh_len, int fileid_type)
{
struct xfs_fid64 *fid64 = (struct xfs_fid64 *)fid;
struct inode *inode = NULL;
if (fh_len < xfs_fileid_length(fileid_type))
return NULL;
switch (fileid_type) {
case FILEID_INO32_GEN_PARENT:
case FILEID_INO32_GEN:
inode = xfs_nfs_get_inode(sb, fid->i32.ino, fid->i32.gen);
break;
case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
case FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG:
inode = xfs_nfs_get_inode(sb, fid64->ino, fid64->gen);
break;
}
return d_obtain_alias(inode);
}
STATIC struct dentry *
xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid,
int fh_len, int fileid_type)
{
struct xfs_fid64 *fid64 = (struct xfs_fid64 *)fid;
struct inode *inode = NULL;
if (fh_len < xfs_fileid_length(fileid_type))
return NULL;
switch (fileid_type) {
case FILEID_INO32_GEN_PARENT:
inode = xfs_nfs_get_inode(sb, fid->i32.parent_ino,
fid->i32.parent_gen);
break;
case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG:
inode = xfs_nfs_get_inode(sb, fid64->parent_ino,
fid64->parent_gen);
break;
}
return d_obtain_alias(inode);
}
STATIC struct dentry *
xfs_fs_get_parent(
struct dentry *child)
{
int error;
struct xfs_inode *cip;
error = xfs_lookup(XFS_I(d_inode(child)), &xfs_name_dotdot, &cip, NULL);
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_log_format.h`, `xfs_trans_resv.h`, `xfs_mount.h`, `xfs_dir2.h`, `xfs_export.h`.
- Detected declarations: `function Copyright`, `function xfs_fs_encode_fh`, `function xfs_nfs_get_inode`, `function xfs_fs_fh_to_dentry`, `function xfs_fs_fh_to_parent`, `function xfs_fs_get_parent`, `function xfs_fs_nfs_commit_metadata`.
- 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.