drivers/scsi/esas2r/esas2r_targdb.c
Source file repositories/reference/linux-study-clean/drivers/scsi/esas2r/esas2r_targdb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/esas2r/esas2r_targdb.c- Extension
.c- Size
- 7599 bytes
- Lines
- 307
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
esas2r.h
Detected Declarations
function esas2r_targ_db_initializefunction esas2r_targ_db_remove_allfunction esas2r_targ_db_report_changesfunction esas2r_targ_db_removefunction esas2r_targ_db_find_next_presentfunction esas2r_targ_db_get_tgt_cnt
Annotated Snippet
if (notify) {
esas2r_trace("remove id:%d", esas2r_targ_get_id(t,
a));
esas2r_target_state_changed(a, esas2r_targ_get_id(t,
a),
TS_NOT_PRESENT);
}
}
}
void esas2r_targ_db_report_changes(struct esas2r_adapter *a)
{
struct esas2r_target *t;
unsigned long flags;
esas2r_trace_enter();
if (test_bit(AF_DISC_PENDING, &a->flags)) {
esas2r_trace_exit();
return;
}
for (t = a->targetdb; t < a->targetdb_end; t++) {
u8 state = TS_INVALID;
spin_lock_irqsave(&a->mem_lock, flags);
if (t->buffered_target_state != t->target_state)
state = t->buffered_target_state = t->target_state;
spin_unlock_irqrestore(&a->mem_lock, flags);
if (state != TS_INVALID) {
esas2r_trace("targ_db_report_changes:%d",
esas2r_targ_get_id(
t,
a));
esas2r_trace("state:%d", state);
esas2r_target_state_changed(a,
esas2r_targ_get_id(t,
a),
state);
}
}
esas2r_trace_exit();
}
struct esas2r_target *esas2r_targ_db_add_raid(struct esas2r_adapter *a,
struct esas2r_disc_context *
dc)
{
struct esas2r_target *t;
esas2r_trace_enter();
if (dc->curr_virt_id >= ESAS2R_MAX_TARGETS) {
esas2r_bugon();
esas2r_trace_exit();
return NULL;
}
t = a->targetdb + dc->curr_virt_id;
if (t->target_state == TS_PRESENT) {
esas2r_trace_exit();
return NULL;
}
esas2r_hdebug("add RAID %s, T:%d", dc->raid_grp_name,
esas2r_targ_get_id(
t,
a));
if (dc->interleave == 0
|| dc->block_size == 0) {
/* these are invalid values, don't create the target entry. */
esas2r_hdebug("invalid RAID group dimensions");
esas2r_trace_exit();
return NULL;
}
t->block_size = dc->block_size;
t->inter_byte = dc->interleave;
t->inter_block = dc->interleave / dc->block_size;
t->virt_targ_id = dc->curr_virt_id;
t->phys_targ_id = ESAS2R_TARG_ID_INV;
Annotation
- Immediate include surface: `esas2r.h`.
- Detected declarations: `function esas2r_targ_db_initialize`, `function esas2r_targ_db_remove_all`, `function esas2r_targ_db_report_changes`, `function esas2r_targ_db_remove`, `function esas2r_targ_db_find_next_present`, `function esas2r_targ_db_get_tgt_cnt`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.