fs/dlm/lockspace.c
Source file repositories/reference/linux-study-clean/fs/dlm/lockspace.c
File Facts
- System
- Linux kernel
- Corpus path
fs/dlm/lockspace.c- Extension
.c- Size
- 20044 bytes
- Lines
- 842
- 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/module.hdlm_internal.hlockspace.hmember.hrecoverd.hdir.hmidcomms.hconfig.hmemory.hlock.hrecover.hrequestqueue.huser.hast.h
Detected Declarations
struct dlm_attrfunction dlm_control_storefunction dlm_event_storefunction dlm_id_showfunction dlm_id_storefunction dlm_nodir_showfunction dlm_nodir_storefunction dlm_recover_status_showfunction dlm_recover_nodeid_showfunction dlm_attr_showfunction dlm_attr_storefunction do_ueventfunction dlm_ueventfunction dlm_lockspace_initfunction dlm_lockspace_exitfunction list_for_each_entryfunction dlm_put_lockspacefunction remove_lockspacefunction threads_startfunction lkb_idr_freefunction rhash_free_rsbfunction free_lockspacefunction new_lockspacefunction __dlm_new_lockspacefunction dlm_new_lockspacefunction dlm_new_user_lockspacefunction lockspace_busyfunction xa_for_eachfunction xa_for_eachfunction release_lockspacefunction dlm_release_lockspacefunction dlm_stop_lockspaces
Annotated Snippet
struct dlm_attr {
struct attribute attr;
ssize_t (*show)(struct dlm_ls *, char *);
ssize_t (*store)(struct dlm_ls *, const char *, size_t);
};
static struct dlm_attr dlm_attr_control = {
.attr = {.name = "control", .mode = S_IWUSR},
.store = dlm_control_store
};
static struct dlm_attr dlm_attr_event = {
.attr = {.name = "event_done", .mode = S_IWUSR},
.store = dlm_event_store
};
static struct dlm_attr dlm_attr_id = {
.attr = {.name = "id", .mode = S_IRUGO | S_IWUSR},
.show = dlm_id_show,
.store = dlm_id_store
};
static struct dlm_attr dlm_attr_nodir = {
.attr = {.name = "nodir", .mode = S_IRUGO | S_IWUSR},
.show = dlm_nodir_show,
.store = dlm_nodir_store
};
static struct dlm_attr dlm_attr_recover_status = {
.attr = {.name = "recover_status", .mode = S_IRUGO},
.show = dlm_recover_status_show
};
static struct dlm_attr dlm_attr_recover_nodeid = {
.attr = {.name = "recover_nodeid", .mode = S_IRUGO},
.show = dlm_recover_nodeid_show
};
static struct attribute *dlm_attrs[] = {
&dlm_attr_control.attr,
&dlm_attr_event.attr,
&dlm_attr_id.attr,
&dlm_attr_nodir.attr,
&dlm_attr_recover_status.attr,
&dlm_attr_recover_nodeid.attr,
NULL,
};
ATTRIBUTE_GROUPS(dlm);
static ssize_t dlm_attr_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);
struct dlm_attr *a = container_of(attr, struct dlm_attr, attr);
return a->show ? a->show(ls, buf) : 0;
}
static ssize_t dlm_attr_store(struct kobject *kobj, struct attribute *attr,
const char *buf, size_t len)
{
struct dlm_ls *ls = container_of(kobj, struct dlm_ls, ls_kobj);
struct dlm_attr *a = container_of(attr, struct dlm_attr, attr);
return a->store ? a->store(ls, buf, len) : len;
}
static const struct sysfs_ops dlm_attr_ops = {
.show = dlm_attr_show,
.store = dlm_attr_store,
};
static struct kobj_type dlm_ktype = {
.default_groups = dlm_groups,
.sysfs_ops = &dlm_attr_ops,
};
static struct kset *dlm_kset;
static int do_uevent(struct dlm_ls *ls, int in, unsigned int release_recover)
{
char message[512] = {};
char *envp[] = { message, NULL };
if (in) {
kobject_uevent(&ls->ls_kobj, KOBJ_ONLINE);
} else {
snprintf(message, 511, "RELEASE_RECOVER=%u", release_recover);
kobject_uevent_env(&ls->ls_kobj, KOBJ_OFFLINE, envp);
}
log_rinfo(ls, "%s the lockspace group...", in ? "joining" : "leaving");
Annotation
- Immediate include surface: `linux/module.h`, `dlm_internal.h`, `lockspace.h`, `member.h`, `recoverd.h`, `dir.h`, `midcomms.h`, `config.h`.
- Detected declarations: `struct dlm_attr`, `function dlm_control_store`, `function dlm_event_store`, `function dlm_id_show`, `function dlm_id_store`, `function dlm_nodir_show`, `function dlm_nodir_store`, `function dlm_recover_status_show`, `function dlm_recover_nodeid_show`, `function dlm_attr_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.