fs/gfs2/ops_fstype.c
Source file repositories/reference/linux-study-clean/fs/gfs2/ops_fstype.c
File Facts
- System
- Linux kernel
- Corpus path
fs/gfs2/ops_fstype.c- Extension
.c- Size
- 47140 bytes
- Lines
- 1817
- 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/sched.hlinux/slab.hlinux/spinlock.hlinux/completion.hlinux/buffer_head.hlinux/blkdev.hlinux/kthread.hlinux/export.hlinux/namei.hlinux/mount.hlinux/gfs2_ondisk.hlinux/quotaops.hlinux/lockdep.hlinux/module.hlinux/backing-dev.hlinux/fs_parser.hgfs2.hincore.hbmap.hglock.hglops.hinode.hrecovery.hrgrp.hsuper.hsys.hutil.hlog.hquota.hdir.hmeta_io.htrace_gfs2.h
Detected Declarations
enum gfs2_paramenum opt_dataenum opt_errorsfunction Copyrightfunction free_sbdfunction gfs2_check_sbfunction gfs2_sb_infunction directoryfunction gfs2_read_sbfunction init_namesfunction init_lockingfunction gfs2_lookup_rootfunction init_sbfunction gfs2_others_may_mountfunction gfs2_jindex_holdfunction init_journalfunction uninit_statfsfunction init_journalfunction init_inodesfunction init_per_nodefunction gfs2_lm_mountfunction gfs2_lm_unmountfunction wait_on_journalfunction gfs2_online_ueventfunction init_threadsfunction gfs2_destroy_threadsfunction gfs2_fill_superfunction negativefunction gfs2_get_treefunction gfs2_fc_freefunction gfs2_parse_paramfunction gfs2_reconfigurefunction gfs2_init_fs_contextfunction set_meta_superfunction test_meta_superfunction gfs2_meta_get_treefunction gfs2_meta_init_fs_contextfunction evict_inodesfunction gfs2_kill_sb
Annotated Snippet
if (error == -ENOENT) {
error = 0;
break;
}
gfs2_glock_dq_uninit(ji_gh);
if (error)
break;
error = -ENOMEM;
jd = kzalloc_obj(struct gfs2_jdesc);
if (!jd)
break;
INIT_LIST_HEAD(&jd->extent_list);
INIT_LIST_HEAD(&jd->jd_revoke_list);
INIT_WORK(&jd->jd_work, gfs2_recover_func);
jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
if (IS_ERR_OR_NULL(jd->jd_inode)) {
if (!jd->jd_inode)
error = -ENOENT;
else
error = PTR_ERR(jd->jd_inode);
kfree(jd);
break;
}
d_mark_dontcache(jd->jd_inode);
spin_lock(&sdp->sd_jindex_spin);
jd->jd_jid = sdp->sd_journals++;
list_add_tail(&jd->jd_list, &sdp->sd_jindex_list);
spin_unlock(&sdp->sd_jindex_spin);
}
mutex_unlock(&sdp->sd_jindex_mutex);
return error;
}
/**
* init_statfs - look up and initialize master and local (per node) statfs inodes
* @sdp: The GFS2 superblock
*
* This should be called after the jindex is initialized in init_journal() and
* before gfs2_journal_recovery() is called because we need to be able to write
* to these inodes during recovery.
*
* Returns: errno
*/
static int init_statfs(struct gfs2_sbd *sdp)
{
int error = 0;
struct inode *master = d_inode(sdp->sd_master_dir);
struct inode *pn = NULL;
char buf[30];
struct gfs2_jdesc *jd;
struct gfs2_inode *ip;
sdp->sd_statfs_inode = gfs2_lookup_meta(master, "statfs");
if (IS_ERR(sdp->sd_statfs_inode)) {
error = PTR_ERR(sdp->sd_statfs_inode);
fs_err(sdp, "can't read in statfs inode: %d\n", error);
goto out;
}
if (sdp->sd_args.ar_spectator)
goto out;
pn = gfs2_lookup_meta(master, "per_node");
if (IS_ERR(pn)) {
error = PTR_ERR(pn);
fs_err(sdp, "can't find per_node directory: %d\n", error);
goto put_statfs;
}
/* For each jid, lookup the corresponding local statfs inode in the
* per_node metafs directory and save it in the sdp->sd_sc_inodes_list. */
list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
struct local_statfs_inode *lsi =
kmalloc_obj(struct local_statfs_inode, GFP_NOFS);
if (!lsi) {
error = -ENOMEM;
goto free_local;
}
sprintf(buf, "statfs_change%u", jd->jd_jid);
lsi->si_sc_inode = gfs2_lookup_meta(pn, buf);
if (IS_ERR(lsi->si_sc_inode)) {
error = PTR_ERR(lsi->si_sc_inode);
fs_err(sdp, "can't find local \"sc\" file#%u: %d\n",
Annotation
- Immediate include surface: `linux/sched.h`, `linux/slab.h`, `linux/spinlock.h`, `linux/completion.h`, `linux/buffer_head.h`, `linux/blkdev.h`, `linux/kthread.h`, `linux/export.h`.
- Detected declarations: `enum gfs2_param`, `enum opt_data`, `enum opt_errors`, `function Copyright`, `function free_sbd`, `function gfs2_check_sb`, `function gfs2_sb_in`, `function directory`, `function gfs2_read_sb`, `function init_names`.
- 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.