nvme-fc: move remote port get/put/free location
move nvme_fc_rport_get/put and rport free to higher in the file to avoid adding prototypes to resolve references in upcoming code additions Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
5f5685569a
commit
469d0ef06d
@ -489,6 +489,45 @@ nvme_fc_signal_discovery_scan(struct nvme_fc_lport *lport,
|
|||||||
kobject_uevent_env(&fc_udev_device->kobj, KOBJ_CHANGE, envp);
|
kobject_uevent_env(&fc_udev_device->kobj, KOBJ_CHANGE, envp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nvme_fc_free_rport(struct kref *ref)
|
||||||
|
{
|
||||||
|
struct nvme_fc_rport *rport =
|
||||||
|
container_of(ref, struct nvme_fc_rport, ref);
|
||||||
|
struct nvme_fc_lport *lport =
|
||||||
|
localport_to_lport(rport->remoteport.localport);
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
WARN_ON(rport->remoteport.port_state != FC_OBJSTATE_DELETED);
|
||||||
|
WARN_ON(!list_empty(&rport->ctrl_list));
|
||||||
|
|
||||||
|
/* remove from lport list */
|
||||||
|
spin_lock_irqsave(&nvme_fc_lock, flags);
|
||||||
|
list_del(&rport->endp_list);
|
||||||
|
spin_unlock_irqrestore(&nvme_fc_lock, flags);
|
||||||
|
|
||||||
|
/* let the LLDD know we've finished tearing it down */
|
||||||
|
lport->ops->remoteport_delete(&rport->remoteport);
|
||||||
|
|
||||||
|
ida_simple_remove(&lport->endp_cnt, rport->remoteport.port_num);
|
||||||
|
|
||||||
|
kfree(rport);
|
||||||
|
|
||||||
|
nvme_fc_lport_put(lport);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nvme_fc_rport_put(struct nvme_fc_rport *rport)
|
||||||
|
{
|
||||||
|
kref_put(&rport->ref, nvme_fc_free_rport);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
nvme_fc_rport_get(struct nvme_fc_rport *rport)
|
||||||
|
{
|
||||||
|
return kref_get_unless_zero(&rport->ref);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nvme_fc_register_remoteport - transport entry point called by an
|
* nvme_fc_register_remoteport - transport entry point called by an
|
||||||
* LLDD to register the existence of a NVME
|
* LLDD to register the existence of a NVME
|
||||||
@ -568,45 +607,6 @@ out_reghost_failed:
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(nvme_fc_register_remoteport);
|
EXPORT_SYMBOL_GPL(nvme_fc_register_remoteport);
|
||||||
|
|
||||||
static void
|
|
||||||
nvme_fc_free_rport(struct kref *ref)
|
|
||||||
{
|
|
||||||
struct nvme_fc_rport *rport =
|
|
||||||
container_of(ref, struct nvme_fc_rport, ref);
|
|
||||||
struct nvme_fc_lport *lport =
|
|
||||||
localport_to_lport(rport->remoteport.localport);
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
WARN_ON(rport->remoteport.port_state != FC_OBJSTATE_DELETED);
|
|
||||||
WARN_ON(!list_empty(&rport->ctrl_list));
|
|
||||||
|
|
||||||
/* remove from lport list */
|
|
||||||
spin_lock_irqsave(&nvme_fc_lock, flags);
|
|
||||||
list_del(&rport->endp_list);
|
|
||||||
spin_unlock_irqrestore(&nvme_fc_lock, flags);
|
|
||||||
|
|
||||||
/* let the LLDD know we've finished tearing it down */
|
|
||||||
lport->ops->remoteport_delete(&rport->remoteport);
|
|
||||||
|
|
||||||
ida_simple_remove(&lport->endp_cnt, rport->remoteport.port_num);
|
|
||||||
|
|
||||||
kfree(rport);
|
|
||||||
|
|
||||||
nvme_fc_lport_put(lport);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nvme_fc_rport_put(struct nvme_fc_rport *rport)
|
|
||||||
{
|
|
||||||
kref_put(&rport->ref, nvme_fc_free_rport);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
nvme_fc_rport_get(struct nvme_fc_rport *rport)
|
|
||||||
{
|
|
||||||
return kref_get_unless_zero(&rport->ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nvme_fc_abort_lsops(struct nvme_fc_rport *rport)
|
nvme_fc_abort_lsops(struct nvme_fc_rport *rport)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user