fs/gfs2/util.c
Source file repositories/reference/linux-study-clean/fs/gfs2/util.c
File Facts
- System
- Linux kernel
- Corpus path
fs/gfs2/util.c- Extension
.c- Size
- 11424 bytes
- Lines
- 437
- 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/spinlock.hlinux/completion.hlinux/buffer_head.hlinux/kthread.hlinux/crc32.hlinux/gfs2_ondisk.hlinux/delay.hlinux/uaccess.hgfs2.hincore.hglock.hglops.hlog.hlops.hrecovery.hrgrp.hsuper.hutil.h
Detected Declarations
function gfs2_assert_ifunction check_journal_cleanfunction gfs2_freeze_lock_sharedfunction gfs2_freeze_unlockfunction do_withdrawfunction gfs2_lmfunction gfs2_offline_ueventfunction gfs2_withdraw_funcfunction gfs2_withdrawfunction gfs2_assert_withdraw_ifunction gfs2_assert_warn_ifunction gfs2_consist_ifunction gfs2_consist_inode_ifunction gfs2_consist_rgrpd_ifunction gfs2_meta_check_iifunction gfs2_metatype_check_iifunction gfs2_io_error_ifunction gfs2_io_error_bh_i
Annotated Snippet
if (device_inactive) {
lm->lm_unmount(sdp, false);
do_withdraw(sdp);
} else {
do_withdraw(sdp);
lm->lm_unmount(sdp, false);
}
} else {
do_withdraw(sdp);
}
fs_err(sdp, "file system withdrawn\n");
}
void gfs2_withdraw(struct gfs2_sbd *sdp)
{
if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW ||
sdp->sd_args.ar_errors == GFS2_ERRORS_DEACTIVATE) {
if (test_and_set_bit(SDF_WITHDRAWN, &sdp->sd_flags))
return;
dump_stack();
/*
* There is no need to withdraw when the superblock hasn't been
* fully initialized, yet.
*/
if (!(sdp->sd_vfs->s_flags & SB_BORN))
return;
fs_err(sdp, "about to withdraw this file system\n");
schedule_work(&sdp->sd_withdraw_work);
return;
}
if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
panic("GFS2: fsid=%s: panic requested\n", sdp->sd_fsname);
}
/*
* gfs2_assert_withdraw_i - Cause the machine to withdraw if @assertion is false
*/
void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
const char *function, char *file, unsigned int line)
{
if (gfs2_withdrawn(sdp))
return;
fs_err(sdp,
"fatal: assertion \"%s\" failed - "
"function = %s, file = %s, line = %u\n",
assertion, function, file, line);
gfs2_withdraw(sdp);
dump_stack();
}
/*
* gfs2_assert_warn_i - Print a message to the console if @assertion is false
*/
void gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
const char *function, char *file, unsigned int line)
{
if (time_before(jiffies,
sdp->sd_last_warning +
gfs2_tune_get(sdp, gt_complain_secs) * HZ))
return;
if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
fs_warn(sdp, "warning: assertion \"%s\" failed - "
"function = %s, file = %s, line = %u\n",
assertion, function, file, line);
if (sdp->sd_args.ar_debug)
BUG();
else
dump_stack();
if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
panic("GFS2: fsid=%s: warning: assertion \"%s\" failed - "
"function = %s, file = %s, line = %u\n",
sdp->sd_fsname, assertion,
function, file, line);
sdp->sd_last_warning = jiffies;
}
/*
* gfs2_consist_i - Flag a filesystem consistency error and withdraw
*/
Annotation
- Immediate include surface: `linux/spinlock.h`, `linux/completion.h`, `linux/buffer_head.h`, `linux/kthread.h`, `linux/crc32.h`, `linux/gfs2_ondisk.h`, `linux/delay.h`, `linux/uaccess.h`.
- Detected declarations: `function gfs2_assert_i`, `function check_journal_clean`, `function gfs2_freeze_lock_shared`, `function gfs2_freeze_unlock`, `function do_withdraw`, `function gfs2_lm`, `function gfs2_offline_uevent`, `function gfs2_withdraw_func`, `function gfs2_withdraw`, `function gfs2_assert_withdraw_i`.
- 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.