fs/smb/client/inode.c
Source file repositories/reference/linux-study-clean/fs/smb/client/inode.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/inode.c- Extension
.c- Size
- 96474 bytes
- Lines
- 3519
- 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/fs.hlinux/fs_struct.hlinux/stat.hlinux/slab.hlinux/pagemap.hlinux/freezer.hlinux/sched/signal.hlinux/wait_bit.hlinux/fiemap.hasm/div64.hcifsfs.hcifsglob.hcifsproto.hsmb2proto.hcifs_debug.hcifs_fs_sb.hcifs_unicode.hfscache.hfs_context.hcifs_ioctl.hcached_dir.hreparse.h
Detected Declarations
function Copyrightfunction cifs_set_netfs_contextfunction cifs_set_opsfunction cifs_revalidate_cachefunction netfs_read_remote_i_sizefunction cifs_nlink_fattr_to_inodefunction cifs_fattr_to_inodefunction cifs_fill_uniqueidfunction cifs_unix_basic_to_fattrfunction submountfunction update_inode_infofunction CIFS_Ifunction cifs_get_file_info_unixfunction cifs_get_unix_fattrfunction cifs_get_inode_info_unixfunction cifs_get_unix_fattrfunction cifs_get_inode_info_unixfunction cifs_sfu_typefunction cifs_sfu_modefunction wire_perms_to_posixfunction wire_filetype_to_posixfunction wire_mode_to_posixfunction smb311_posix_info_to_fattrfunction cifs_open_info_to_fattrfunction cifs_get_file_infofunction simple_hashstrfunction full_pathfunction cifs_set_fattr_inofunction is_inode_cache_goodfunction reparse_info_to_fattrfunction cifs_get_fattrfunction cifs_get_inode_infofunction smb311_posix_get_fattrfunction smb311_posix_get_inode_infofunction cifs_find_inodefunction cifs_init_inodefunction inode_has_hashed_dentriesfunction cifs_igetfunction cifs_set_file_infofunction filefunction cifs_drop_nlinkfunction d_inodefunction le64_to_cpufunction d_countfunction cifs_unlinkfunction cifs_mkdir_qinfofunction cifs_posix_mkdirfunction le64_to_cpu
Annotated Snippet
if (sbflags & CIFS_MOUNT_DIRECT_IO) {
set_bit(NETFS_ICTX_UNBUFFERED, &ictx->flags);
if (sbflags & CIFS_MOUNT_NO_BRL)
inode->i_fop = &cifs_file_direct_nobrl_ops;
else
inode->i_fop = &cifs_file_direct_ops;
} else if (sbflags & CIFS_MOUNT_STRICT_IO) {
if (sbflags & CIFS_MOUNT_NO_BRL)
inode->i_fop = &cifs_file_strict_nobrl_ops;
else
inode->i_fop = &cifs_file_strict_ops;
} else if (sbflags & CIFS_MOUNT_NO_BRL)
inode->i_fop = &cifs_file_nobrl_ops;
else { /* not direct, send byte range locks */
inode->i_fop = &cifs_file_ops;
}
/* check if server can support readahead */
if (tcon->ses->server->max_read < PAGE_SIZE + MAX_CIFS_HDR_SIZE)
inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
else
inode->i_data.a_ops = &cifs_addr_ops;
mapping_set_large_folios(inode->i_mapping);
break;
case S_IFDIR:
if (IS_AUTOMOUNT(inode)) {
inode->i_op = &cifs_namespace_inode_operations;
} else {
inode->i_op = &cifs_dir_inode_ops;
inode->i_fop = &cifs_dir_ops;
}
break;
case S_IFLNK:
inode->i_op = &cifs_symlink_inode_ops;
break;
default:
init_special_inode(inode, inode->i_mode, inode->i_rdev);
break;
}
}
/* check inode attributes against fattr. If they don't match, tag the
* inode for cache invalidation
*/
static void
cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr)
{
struct cifs_fscache_inode_coherency_data cd;
struct cifsInodeInfo *cifs_i = CIFS_I(inode);
struct timespec64 mtime;
cifs_dbg(FYI, "%s: revalidating inode %llu\n",
__func__, cifs_i->uniqueid);
if (inode_state_read_once(inode) & I_NEW) {
cifs_dbg(FYI, "%s: inode %llu is new\n",
__func__, cifs_i->uniqueid);
return;
}
/* don't bother with revalidation if we have an oplock */
if (CIFS_CACHE_READ(cifs_i)) {
cifs_dbg(FYI, "%s: inode %llu is oplocked\n",
__func__, cifs_i->uniqueid);
return;
}
/* revalidate if mtime or size have changed */
fattr->cf_mtime = timestamp_truncate(fattr->cf_mtime, inode);
mtime = inode_get_mtime(inode);
if (timespec64_equal(&mtime, &fattr->cf_mtime) &&
netfs_read_remote_i_size(inode) == fattr->cf_eof) {
cifs_dbg(FYI, "%s: inode %llu is unchanged\n",
__func__, cifs_i->uniqueid);
return;
}
cifs_dbg(FYI, "%s: invalidating inode %llu mapping\n",
__func__, cifs_i->uniqueid);
set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags);
/* Invalidate fscache cookie */
cifs_fscache_fill_coherency(&cifs_i->netfs.inode, &cd);
fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0);
}
/*
* copy nlink to the inode, unless it wasn't provided. Provide
* sane values if we don't have an existing one and none was provided
*/
static void
Annotation
- Immediate include surface: `linux/fs.h`, `linux/fs_struct.h`, `linux/stat.h`, `linux/slab.h`, `linux/pagemap.h`, `linux/freezer.h`, `linux/sched/signal.h`, `linux/wait_bit.h`.
- Detected declarations: `function Copyright`, `function cifs_set_netfs_context`, `function cifs_set_ops`, `function cifs_revalidate_cache`, `function netfs_read_remote_i_size`, `function cifs_nlink_fattr_to_inode`, `function cifs_fattr_to_inode`, `function cifs_fill_uniqueid`, `function cifs_unix_basic_to_fattr`, `function submount`.
- 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.