fs/gfs2/sys.c
Source file repositories/reference/linux-study-clean/fs/gfs2/sys.c
File Facts
- System
- Linux kernel
- Corpus path
fs/gfs2/sys.c- Extension
.c- Size
- 20611 bytes
- Lines
- 798
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched.hlinux/cred.hlinux/spinlock.hlinux/completion.hlinux/buffer_head.hlinux/module.hlinux/kobject.hlinux/uaccess.hlinux/gfs2_ondisk.hlinux/blkdev.hgfs2.hincore.hsys.hsuper.hglock.hquota.hutil.hglops.hrecovery.h
Detected Declarations
struct gfs2_attrfunction gfs2_attr_showfunction gfs2_attr_storefunction id_showfunction status_showfunction fsname_showfunction uuid_showfunction freeze_showfunction freeze_storefunction withdraw_showfunction withdraw_storefunction statfs_sync_storefunction quota_sync_storefunction quota_refresh_user_storefunction quota_refresh_group_storefunction demote_rq_storefunction gfs2_sbd_releasefunction proto_name_showfunction block_showfunction block_storefunction withdraw_helper_status_storefunction lkfirst_showfunction lkfirst_storefunction first_done_showfunction gfs2_recover_setfunction recover_storefunction recover_done_showfunction recover_status_showfunction jid_showfunction jid_storefunction quota_scale_showfunction quota_scale_storefunction tune_setfunction gfs2_sys_fs_addfunction gfs2_sys_fs_delfunction gfs2_ueventfunction gfs2_sys_initfunction gfs2_sys_uninit
Annotated Snippet
struct gfs2_attr {
struct attribute attr;
ssize_t (*show)(struct gfs2_sbd *, char *);
ssize_t (*store)(struct gfs2_sbd *, const char *, size_t);
};
static ssize_t gfs2_attr_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
return a->show ? a->show(sdp, buf) : 0;
}
static ssize_t gfs2_attr_store(struct kobject *kobj, struct attribute *attr,
const char *buf, size_t len)
{
struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
struct gfs2_attr *a = container_of(attr, struct gfs2_attr, attr);
return a->store ? a->store(sdp, buf, len) : len;
}
static const struct sysfs_ops gfs2_attr_ops = {
.show = gfs2_attr_show,
.store = gfs2_attr_store,
};
static struct kset *gfs2_kset;
static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
{
return sysfs_emit(buf, "%u:%u\n",
MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev));
}
static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
{
unsigned long f = sdp->sd_flags;
ssize_t s;
s = sysfs_emit(buf,
"Journal Checked: %d\n"
"Journal Live: %d\n"
"Journal ID: %d\n"
"Spectator: %d\n"
"Withdrawn: %d\n"
"No barriers: %d\n"
"No recovery: %d\n"
"Demote: %d\n"
"No Journal ID: %d\n"
"Mounted RO: %d\n"
"RO Recovery: %d\n"
"Skip DLM Unlock: %d\n"
"Force AIL Flush: %d\n"
"FS Freeze Initiator: %d\n"
"FS Frozen: %d\n"
"Killing: %d\n"
"sd_log_error: %d\n"
"sd_log_flush_lock: %d\n"
"sd_log_num_revoke: %u\n"
"sd_log_in_flight: %d\n"
"sd_log_blks_needed: %d\n"
"sd_log_blks_free: %d\n"
"sd_log_flush_head: %d\n"
"sd_log_flush_tail: %d\n"
"sd_log_blks_reserved: %d\n"
"sd_log_revokes_available: %d\n"
"sd_log_pinned: %d\n"
"sd_log_thresh1: %d\n"
"sd_log_thresh2: %d\n",
test_bit(SDF_JOURNAL_CHECKED, &f),
test_bit(SDF_JOURNAL_LIVE, &f),
(sdp->sd_jdesc ? sdp->sd_jdesc->jd_jid : 0),
(sdp->sd_args.ar_spectator ? 1 : 0),
test_bit(SDF_WITHDRAWN, &f),
test_bit(SDF_NOBARRIERS, &f),
test_bit(SDF_NORECOVERY, &f),
test_bit(SDF_DEMOTE, &f),
test_bit(SDF_NOJOURNALID, &f),
(sb_rdonly(sdp->sd_vfs) ? 1 : 0),
test_bit(SDF_RORECOVERY, &f),
test_bit(SDF_SKIP_DLM_UNLOCK, &f),
test_bit(SDF_FORCE_AIL_FLUSH, &f),
test_bit(SDF_FREEZE_INITIATOR, &f),
test_bit(SDF_FROZEN, &f),
test_bit(SDF_KILL, &f),
sdp->sd_log_error,
rwsem_is_locked(&sdp->sd_log_flush_lock),
sdp->sd_log_num_revoke,
Annotation
- Immediate include surface: `linux/sched.h`, `linux/cred.h`, `linux/spinlock.h`, `linux/completion.h`, `linux/buffer_head.h`, `linux/module.h`, `linux/kobject.h`, `linux/uaccess.h`.
- Detected declarations: `struct gfs2_attr`, `function gfs2_attr_show`, `function gfs2_attr_store`, `function id_show`, `function status_show`, `function fsname_show`, `function uuid_show`, `function freeze_show`, `function freeze_store`, `function withdraw_show`.
- 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.