fs/dlm/member.c
Source file repositories/reference/linux-study-clean/fs/dlm/member.c
File Facts
- System
- Linux kernel
- Corpus path
fs/dlm/member.c- Extension
.c- Size
- 17682 bytes
- Lines
- 773
- 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
dlm_internal.hlockspace.hmember.hrecoverd.hrecover.hrcom.hconfig.hmidcomms.hlowcomms.h
Detected Declarations
function Copyrightfunction dlm_slot_savefunction dlm_slots_copy_outfunction log_slotsfunction dlm_slots_copy_infunction list_for_each_entryfunction wait_status_allfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction list_for_each_entryfunction add_ordered_memberfunction list_for_eachfunction add_remote_memberfunction dlm_add_memberfunction list_for_each_entryfunction dlm_is_memberfunction dlm_is_removedfunction clear_memb_listfunction remove_remote_memberfunction dlm_clear_membersfunction dlm_clear_members_gonefunction make_member_arrayfunction list_for_each_entryfunction list_for_each_entryfunction ping_membersfunction list_for_each_entryfunction dlm_lsop_recover_prepfunction dlm_lsop_recover_slotfunction dlm_lsop_recover_donefunction dlm_recover_membersfunction list_for_each_entryfunction list_for_each_entry_safefunction list_for_each_entryfunction dlm_ls_startfunction dlm_ls_start
Annotated Snippet
if (memb->nodeid == our_nodeid) {
if (ls->ls_slot && ls->ls_slot != memb->slot) {
log_error(ls, "dlm_slots_copy_in our slot "
"changed %d %d", ls->ls_slot,
memb->slot);
return -1;
}
if (!ls->ls_slot)
ls->ls_slot = memb->slot;
}
if (!memb->slot) {
log_error(ls, "dlm_slots_copy_in nodeid %d no slot",
memb->nodeid);
return -1;
}
}
return 0;
}
/* for any nodes that do not support slots, we will not have set memb->slot
in wait_status_all(), so memb->slot will remain -1, and we will not
assign slots or set ls_num_slots here */
int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size,
struct dlm_slot **slots_out, uint32_t *gen_out)
{
struct dlm_member *memb;
struct dlm_slot *array;
int our_nodeid = dlm_our_nodeid();
int array_size, max_slots, i;
int need = 0;
int max = 0;
int num = 0;
uint32_t gen = 0;
/* our own memb struct will have slot -1 gen 0 */
list_for_each_entry(memb, &ls->ls_nodes, list) {
if (memb->nodeid == our_nodeid) {
memb->slot = ls->ls_slot;
memb->generation = ls->ls_generation;
break;
}
}
list_for_each_entry(memb, &ls->ls_nodes, list) {
if (memb->generation > gen)
gen = memb->generation;
/* node doesn't support slots */
if (memb->slot == -1)
return -1;
/* node needs a slot assigned */
if (!memb->slot)
need++;
/* node has a slot assigned */
num++;
if (!max || max < memb->slot)
max = memb->slot;
/* sanity check, once slot is assigned it shouldn't change */
if (memb->slot_prev && memb->slot && memb->slot_prev != memb->slot) {
log_error(ls, "nodeid %d slot changed %d %d",
memb->nodeid, memb->slot_prev, memb->slot);
return -1;
}
memb->slot_prev = memb->slot;
}
array_size = max + need;
array = kzalloc_objs(*array, array_size, GFP_NOFS);
if (!array)
return -ENOMEM;
num = 0;
/* fill in slots (offsets) that are used */
list_for_each_entry(memb, &ls->ls_nodes, list) {
if (!memb->slot)
Annotation
- Immediate include surface: `dlm_internal.h`, `lockspace.h`, `member.h`, `recoverd.h`, `recover.h`, `rcom.h`, `config.h`, `midcomms.h`.
- Detected declarations: `function Copyright`, `function dlm_slot_save`, `function dlm_slots_copy_out`, `function log_slots`, `function dlm_slots_copy_in`, `function list_for_each_entry`, `function wait_status_all`, `function list_for_each_entry`, `function list_for_each_entry`, `function list_for_each_entry`.
- 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.