fs/ocfs2/dlm/dlmdebug.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/dlm/dlmdebug.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/dlm/dlmdebug.c- Extension
.c- Size
- 22926 bytes
- Lines
- 845
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/types.hlinux/slab.hlinux/highmem.hlinux/sysctl.hlinux/spinlock.hlinux/debugfs.hlinux/export.hlinux/string_choices.h../cluster/heartbeat.h../cluster/nodemanager.h../cluster/tcp.hdlmapi.hdlmcommon.hdlmdomain.hdlmdebug.h../cluster/masklog.h
Detected Declarations
function dlm_print_one_lock_resourcefunction dlm_print_lockres_refmapfunction __dlm_print_lockfunction __dlm_print_one_lock_resourcefunction dlm_print_one_lockfunction stringify_locknamefunction stringify_nodemapfunction dump_mlefunction dlm_print_one_mlefunction debug_releasefunction debug_readfunction debug_purgelist_printfunction debug_purgelist_openfunction debug_mle_printfunction hlist_for_each_entryfunction debug_mle_openfunction dump_lockfunction dump_lockresfunction list_for_each_entryfunction lockres_seq_stopfunction lockres_seq_showfunction debug_lockres_openfunction debug_lockres_releasefunction debug_state_printfunction debug_state_openfunction dlm_debug_initfunction dlm_create_debugfs_subrootfunction dlm_destroy_debugfs_subrootfunction dlm_create_debugfs_rootfunction dlm_destroy_debugfs_rootexport dlm_print_one_lockexport dlm_errname
Annotated Snippet
static const struct file_operations debug_purgelist_fops = {
.open = debug_purgelist_open,
.release = debug_release,
.read = debug_read,
.llseek = generic_file_llseek,
};
/* end - purge list funcs */
/* begin - debug mle funcs */
static int debug_mle_print(struct dlm_ctxt *dlm, char *buf, int len)
{
struct dlm_master_list_entry *mle;
struct hlist_head *bucket;
int i, out = 0;
unsigned long total = 0, longest = 0, bucket_count = 0;
out += scnprintf(buf + out, len - out,
"Dumping MLEs for Domain: %s\n", dlm->name);
spin_lock(&dlm->master_lock);
for (i = 0; i < DLM_HASH_BUCKETS; i++) {
bucket = dlm_master_hash(dlm, i);
hlist_for_each_entry(mle, bucket, master_hash_node) {
++total;
++bucket_count;
if (len - out < 200)
continue;
out += dump_mle(mle, buf + out, len - out);
}
longest = max(longest, bucket_count);
bucket_count = 0;
}
spin_unlock(&dlm->master_lock);
out += scnprintf(buf + out, len - out,
"Total: %lu, Longest: %lu\n", total, longest);
return out;
}
static int debug_mle_open(struct inode *inode, struct file *file)
{
struct dlm_ctxt *dlm = inode->i_private;
char *buf = NULL;
buf = kzalloc(PAGE_SIZE, GFP_NOFS);
if (!buf)
return -ENOMEM;
i_size_write(inode, debug_mle_print(dlm, buf, PAGE_SIZE - 1));
file->private_data = buf;
return 0;
}
static const struct file_operations debug_mle_fops = {
.open = debug_mle_open,
.release = debug_release,
.read = debug_read,
.llseek = generic_file_llseek,
};
/* end - debug mle funcs */
/* begin - debug lockres funcs */
static int dump_lock(struct dlm_lock *lock, int list_type, char *buf, int len)
{
int out;
#define DEBUG_LOCK_VERSION 1
spin_lock(&lock->spinlock);
out = scnprintf(buf, len, "LOCK:%d,%d,%d,%d,%d,%d:%lld,%d,%d,%d,%d,%d,"
"%d,%d,%d,%d\n",
DEBUG_LOCK_VERSION,
list_type, lock->ml.type, lock->ml.convert_type,
lock->ml.node,
dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
!list_empty(&lock->ast_list),
!list_empty(&lock->bast_list),
lock->ast_pending, lock->bast_pending,
lock->convert_pending, lock->lock_pending,
lock->cancel_pending, lock->unlock_pending,
kref_read(&lock->lock_refs));
spin_unlock(&lock->spinlock);
return out;
}
static int dump_lockres(struct dlm_lock_resource *res, char *buf, int len)
Annotation
- Immediate include surface: `linux/types.h`, `linux/slab.h`, `linux/highmem.h`, `linux/sysctl.h`, `linux/spinlock.h`, `linux/debugfs.h`, `linux/export.h`, `linux/string_choices.h`.
- Detected declarations: `function dlm_print_one_lock_resource`, `function dlm_print_lockres_refmap`, `function __dlm_print_lock`, `function __dlm_print_one_lock_resource`, `function dlm_print_one_lock`, `function stringify_lockname`, `function stringify_nodemap`, `function dump_mle`, `function dlm_print_one_mle`, `function debug_release`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: pattern 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.