drivers/scsi/csiostor/csio_rnode.c
Source file repositories/reference/linux-study-clean/drivers/scsi/csiostor/csio_rnode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/csiostor/csio_rnode.c- Extension
.c- Size
- 23181 bytes
- Lines
- 922
- 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
linux/string.hscsi/scsi_device.hscsi/scsi_transport_fc.hscsi/fc/fc_els.hscsi/fc/fc_fs.hcsio_hw.hcsio_lnode.hcsio_rnode.h
Detected Declarations
function csio_is_rnode_readyfunction csio_is_rnode_uninitfunction csio_is_rnode_wkafunction csio_rn_lookupfunction list_for_eachfunction csio_rn_lookup_wwpnfunction list_for_eachfunction csio_rnode_lookup_portidfunction list_for_eachfunction csio_rn_dup_flowidfunction list_for_eachfunction list_for_eachfunction csio_alloc_rnodefunction csio_free_rnodefunction csio_get_rnodefunction csio_put_rnodefunction csio_confirm_rnodefunction csio_rn_verify_rparamsfunction __csio_reg_rnodefunction __csio_unreg_rnodefunction csio_rns_uninitfunction csio_rns_readyfunction csio_rns_offlinefunction csio_rns_disappearedfunction csio_rnode_devloss_handlerfunction csio_rnode_fwevt_handlerfunction csio_rnode_initfunction csio_rnode_exit
Annotated Snippet
list_for_each(tmp, &rnhead->sm.sm_list) {
rn = (struct csio_rnode *) tmp;
if (csio_is_rnode_ready(rn)) {
if (rn->flowid == rdev_flowid) {
*vnp_flowid = csio_ln_flowid(ln_tmp);
return 1;
}
}
}
}
return 0;
}
static struct csio_rnode *
csio_alloc_rnode(struct csio_lnode *ln)
{
struct csio_hw *hw = csio_lnode_to_hw(ln);
struct csio_rnode *rn = mempool_alloc(hw->rnode_mempool, GFP_ATOMIC);
if (!rn)
goto err;
memset(rn, 0, sizeof(struct csio_rnode));
if (csio_rnode_init(rn, ln))
goto err_free;
CSIO_INC_STATS(ln, n_rnode_alloc);
return rn;
err_free:
mempool_free(rn, hw->rnode_mempool);
err:
CSIO_INC_STATS(ln, n_rnode_nomem);
return NULL;
}
static void
csio_free_rnode(struct csio_rnode *rn)
{
struct csio_hw *hw = csio_lnode_to_hw(csio_rnode_to_lnode(rn));
csio_rnode_exit(rn);
CSIO_INC_STATS(rn->lnp, n_rnode_free);
mempool_free(rn, hw->rnode_mempool);
}
/*
* csio_get_rnode - Gets rnode with the given flowid
* @ln - lnode
* @flowid - flow id.
*
* Does the rnode lookup on the given lnode and flowid. If no matching
* rnode found, then new rnode with given npid is allocated and returned.
*/
static struct csio_rnode *
csio_get_rnode(struct csio_lnode *ln, uint32_t flowid)
{
struct csio_rnode *rn;
rn = csio_rn_lookup(ln, flowid);
if (!rn) {
rn = csio_alloc_rnode(ln);
if (!rn)
return NULL;
rn->flowid = flowid;
}
return rn;
}
/*
* csio_put_rnode - Frees the given rnode
* @ln - lnode
* @flowid - flow id.
*
* Does the rnode lookup on the given lnode and flowid. If no matching
* rnode found, then new rnode with given npid is allocated and returned.
*/
void
csio_put_rnode(struct csio_lnode *ln, struct csio_rnode *rn)
{
CSIO_DB_ASSERT(csio_is_rnode_uninit(rn) != 0);
csio_free_rnode(rn);
}
/*
Annotation
- Immediate include surface: `linux/string.h`, `scsi/scsi_device.h`, `scsi/scsi_transport_fc.h`, `scsi/fc/fc_els.h`, `scsi/fc/fc_fs.h`, `csio_hw.h`, `csio_lnode.h`, `csio_rnode.h`.
- Detected declarations: `function csio_is_rnode_ready`, `function csio_is_rnode_uninit`, `function csio_is_rnode_wka`, `function csio_rn_lookup`, `function list_for_each`, `function csio_rn_lookup_wwpn`, `function list_for_each`, `function csio_rnode_lookup_portid`, `function list_for_each`, `function csio_rn_dup_flowid`.
- 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.