fs/jfs/jfs_inode.c
Source file repositories/reference/linux-study-clean/fs/jfs/jfs_inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/jfs/jfs_inode.c- Extension
.c- Size
- 2895 bytes
- Lines
- 135
- 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/quotaops.hjfs_incore.hjfs_inode.hjfs_filsys.hjfs_imap.hjfs_dinode.hjfs_debug.h
Detected Declarations
function Copyright
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) International Business Machines Corp., 2000-2004
*/
#include <linux/fs.h>
#include <linux/quotaops.h>
#include "jfs_incore.h"
#include "jfs_inode.h"
#include "jfs_filsys.h"
#include "jfs_imap.h"
#include "jfs_dinode.h"
#include "jfs_debug.h"
void jfs_set_inode_flags(struct inode *inode)
{
unsigned int flags = JFS_IP(inode)->mode2;
unsigned int new_fl = 0;
if (flags & JFS_IMMUTABLE_FL)
new_fl |= S_IMMUTABLE;
if (flags & JFS_APPEND_FL)
new_fl |= S_APPEND;
if (flags & JFS_NOATIME_FL)
new_fl |= S_NOATIME;
if (flags & JFS_DIRSYNC_FL)
new_fl |= S_DIRSYNC;
if (flags & JFS_SYNC_FL)
new_fl |= S_SYNC;
inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND | S_NOATIME |
S_DIRSYNC | S_SYNC);
}
/*
* NAME: ialloc()
*
* FUNCTION: Allocate a new inode
*
*/
struct inode *ialloc(struct inode *parent, umode_t mode)
{
struct super_block *sb = parent->i_sb;
struct inode *inode;
struct jfs_inode_info *jfs_inode;
int rc;
inode = new_inode(sb);
if (!inode) {
jfs_warn("ialloc: new_inode returned NULL!");
return ERR_PTR(-ENOMEM);
}
jfs_inode = JFS_IP(inode);
rc = diAlloc(parent, S_ISDIR(mode), inode);
if (rc) {
jfs_warn("ialloc: diAlloc returned %d!", rc);
goto fail_put;
}
if (insert_inode_locked(inode) < 0) {
rc = -EINVAL;
goto fail_put;
}
inode_init_owner(&nop_mnt_idmap, inode, parent, mode);
/*
* New inodes need to save sane values on disk when
* uid & gid mount options are used
*/
jfs_inode->saved_uid = inode->i_uid;
jfs_inode->saved_gid = inode->i_gid;
/*
* Allocate inode to quota.
*/
rc = dquot_initialize(inode);
if (rc)
goto fail_drop;
rc = dquot_alloc_inode(inode);
if (rc)
goto fail_drop;
/* inherit flags from parent */
jfs_inode->mode2 = JFS_IP(parent)->mode2 & JFS_FL_INHERIT;
if (S_ISDIR(mode)) {
jfs_inode->mode2 |= IDIRECTORY;
jfs_inode->mode2 &= ~JFS_DIRSYNC_FL;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/quotaops.h`, `jfs_incore.h`, `jfs_inode.h`, `jfs_filsys.h`, `jfs_imap.h`, `jfs_dinode.h`, `jfs_debug.h`.
- Detected declarations: `function Copyright`.
- 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.