fs/gfs2/super.c
Source file repositories/reference/linux-study-clean/fs/gfs2/super.c
File Facts
- System
- Linux kernel
- Corpus path
fs/gfs2/super.c- Extension
.c- Size
- 40839 bytes
- Lines
- 1584
- 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/bio.hlinux/sched/signal.hlinux/slab.hlinux/spinlock.hlinux/completion.hlinux/buffer_head.hlinux/statfs.hlinux/seq_file.hlinux/mount.hlinux/kthread.hlinux/delay.hlinux/gfs2_ondisk.hlinux/crc32.hlinux/time.hlinux/wait.hlinux/writeback.hlinux/backing-dev.hlinux/kernel.hgfs2.hincore.hbmap.hdir.hglock.hglops.hinode.hlog.hmeta_io.hquota.hrecovery.hrgrp.hsuper.htrans.h
Detected Declarations
struct lfccenum evict_behaviorfunction gfs2_jindex_freefunction list_for_each_entryfunction gfs2_jdesc_checkfunction gfs2_make_fs_rwfunction gfs2_statfs_change_infunction gfs2_statfs_change_outfunction gfs2_statfs_initfunction gfs2_statfs_changefunction update_statfsfunction gfs2_statfs_syncfunction gfs2_lock_fs_check_cleanfunction list_for_each_entryfunction list_for_each_entryfunction gfs2_dinode_outfunction gfs2_write_inodefunction gfs2_dirty_inodefunction gfs2_make_fs_rofunction gfs2_put_superfunction gfs2_sync_fsfunction gfs2_do_thawfunction gfs2_freeze_funcfunction gfs2_freeze_superfunction gfs2_freeze_fsfunction gfs2_thaw_superfunction statfs_slow_fillfunction errorfunction gfs2_statfs_ifunction gfs2_statfsfunction gfs2_drop_inodefunction unlikelyfunction gfs2_show_optionsfunction gfs2_glock_put_eventuallyfunction gfs2_upgrade_iopen_glockfunction evict_should_deletefunction evict_unlinked_inodefunction gfs2_truncate_inode_pagesfunction truncate_inode_pagesfunction gfs2_truncate_inode_pages_finalfunction evict_linked_inodefunction tofunction gfs2_free_inodefunction free_local_statfs_inodes
Annotated Snippet
struct lfcc {
struct list_head list;
struct gfs2_holder gh;
};
/**
* gfs2_lock_fs_check_clean - Stop all writes to the FS and check that all
* journals are clean
* @sdp: the file system
*
* Returns: errno
*/
static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp)
{
struct gfs2_inode *ip;
struct gfs2_jdesc *jd;
struct lfcc *lfcc;
LIST_HEAD(list);
struct gfs2_log_header_host lh;
int error, error2;
/*
* Grab all the journal glocks in SH mode. We are *probably* doing
* that to prevent recovery.
*/
list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
lfcc = kmalloc_obj(struct lfcc);
if (!lfcc) {
error = -ENOMEM;
goto out;
}
ip = GFS2_I(jd->jd_inode);
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &lfcc->gh);
if (error) {
kfree(lfcc);
goto out;
}
list_add(&lfcc->list, &list);
}
gfs2_freeze_unlock(sdp);
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_EXCLUSIVE,
LM_FLAG_RECOVER | GL_NOPID,
&sdp->sd_freeze_gh);
if (error)
goto relock_shared;
list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
error = gfs2_jdesc_check(jd);
if (error)
break;
error = gfs2_find_jhead(jd, &lh);
if (error)
break;
if (!(lh.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
error = -EBUSY;
break;
}
}
if (!error)
goto out; /* success */
gfs2_freeze_unlock(sdp);
relock_shared:
error2 = gfs2_freeze_lock_shared(sdp);
gfs2_assert_withdraw(sdp, !error2);
out:
while (!list_empty(&list)) {
lfcc = list_first_entry(&list, struct lfcc, list);
list_del(&lfcc->list);
gfs2_glock_dq_uninit(&lfcc->gh);
kfree(lfcc);
}
return error;
}
void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
{
const struct inode *inode = &ip->i_inode;
struct gfs2_dinode *str = buf;
str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
str->di_header.mh_type = cpu_to_be32(GFS2_METATYPE_DI);
str->di_header.mh_format = cpu_to_be32(GFS2_FORMAT_DI);
Annotation
- Immediate include surface: `linux/bio.h`, `linux/sched/signal.h`, `linux/slab.h`, `linux/spinlock.h`, `linux/completion.h`, `linux/buffer_head.h`, `linux/statfs.h`, `linux/seq_file.h`.
- Detected declarations: `struct lfcc`, `enum evict_behavior`, `function gfs2_jindex_free`, `function list_for_each_entry`, `function gfs2_jdesc_check`, `function gfs2_make_fs_rw`, `function gfs2_statfs_change_in`, `function gfs2_statfs_change_out`, `function gfs2_statfs_init`, `function gfs2_statfs_change`.
- 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.