fs/ocfs2/cluster/netdebug.c
Source file repositories/reference/linux-study-clean/fs/ocfs2/cluster/netdebug.c
File Facts
- System
- Linux kernel
- Corpus path
fs/ocfs2/cluster/netdebug.c- Extension
.c- Size
- 12711 bytes
- Lines
- 507
- 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/module.hlinux/types.hlinux/slab.hlinux/idr.hlinux/kref.hlinux/seq_file.hlinux/debugfs.hlinux/uaccess.htcp.hnodemanager.hmasklog.htcp_internal.h
Detected Declarations
struct o2net_sock_debugfunction o2net_debug_add_nstfunction o2net_debug_del_nstfunction list_for_each_entryfunction nst_seq_showfunction nst_seq_stopfunction nst_fop_openfunction nst_fop_releasefunction o2net_debug_add_scfunction o2net_debug_del_scfunction list_for_each_entryfunction sc_show_sock_statsfunction sc_show_sock_containerfunction sc_seq_showfunction sc_seq_stopfunction sc_common_openfunction sc_fop_releasefunction stats_fop_openfunction sc_fop_openfunction o2net_fill_bitmapfunction nodes_fop_openfunction o2net_debug_releasefunction o2net_debug_readfunction o2net_debugfs_exitfunction o2net_debugfs_init
Annotated Snippet
static const struct file_operations nst_seq_fops = {
.open = nst_fop_open,
.read = seq_read,
.llseek = seq_lseek,
.release = nst_fop_release,
};
void o2net_debug_add_sc(struct o2net_sock_container *sc)
{
spin_lock_bh(&o2net_debug_lock);
list_add(&sc->sc_net_debug_item, &sock_containers);
spin_unlock_bh(&o2net_debug_lock);
}
void o2net_debug_del_sc(struct o2net_sock_container *sc)
{
spin_lock_bh(&o2net_debug_lock);
list_del_init(&sc->sc_net_debug_item);
spin_unlock_bh(&o2net_debug_lock);
}
struct o2net_sock_debug {
int dbg_ctxt;
struct o2net_sock_container *dbg_sock;
};
static struct o2net_sock_container
*next_sc(struct o2net_sock_container *sc_start)
{
struct o2net_sock_container *sc, *ret = NULL;
assert_spin_locked(&o2net_debug_lock);
list_for_each_entry(sc, &sc_start->sc_net_debug_item,
sc_net_debug_item) {
/* discover the head of the list miscast as a sc */
if (&sc->sc_net_debug_item == &sock_containers)
break;
/* use sc_page to detect real scs in the list */
if (sc->sc_page != NULL) {
ret = sc;
break;
}
}
return ret;
}
static void *sc_seq_start(struct seq_file *seq, loff_t *pos)
{
struct o2net_sock_debug *sd = seq->private;
struct o2net_sock_container *sc, *dummy_sc = sd->dbg_sock;
spin_lock_bh(&o2net_debug_lock);
sc = next_sc(dummy_sc);
spin_unlock_bh(&o2net_debug_lock);
return sc;
}
static void *sc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct o2net_sock_debug *sd = seq->private;
struct o2net_sock_container *sc, *dummy_sc = sd->dbg_sock;
spin_lock_bh(&o2net_debug_lock);
sc = next_sc(dummy_sc);
list_del_init(&dummy_sc->sc_net_debug_item);
if (sc)
list_add(&dummy_sc->sc_net_debug_item, &sc->sc_net_debug_item);
spin_unlock_bh(&o2net_debug_lock);
return sc; /* unused, just needs to be null when done */
}
#ifdef CONFIG_OCFS2_FS_STATS
# define sc_send_count(_s) ((_s)->sc_send_count)
# define sc_recv_count(_s) ((_s)->sc_recv_count)
# define sc_tv_acquiry_total_ns(_s) (ktime_to_ns((_s)->sc_tv_acquiry_total))
# define sc_tv_send_total_ns(_s) (ktime_to_ns((_s)->sc_tv_send_total))
# define sc_tv_status_total_ns(_s) (ktime_to_ns((_s)->sc_tv_status_total))
# define sc_tv_process_total_ns(_s) (ktime_to_ns((_s)->sc_tv_process_total))
#else
# define sc_send_count(_s) (0U)
# define sc_recv_count(_s) (0U)
# define sc_tv_acquiry_total_ns(_s) (0LL)
# define sc_tv_send_total_ns(_s) (0LL)
# define sc_tv_status_total_ns(_s) (0LL)
# define sc_tv_process_total_ns(_s) (0LL)
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/slab.h`, `linux/idr.h`, `linux/kref.h`, `linux/seq_file.h`, `linux/debugfs.h`, `linux/uaccess.h`.
- Detected declarations: `struct o2net_sock_debug`, `function o2net_debug_add_nst`, `function o2net_debug_del_nst`, `function list_for_each_entry`, `function nst_seq_show`, `function nst_seq_stop`, `function nst_fop_open`, `function nst_fop_release`, `function o2net_debug_add_sc`, `function o2net_debug_del_sc`.
- 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.