mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
nvmet-fcloop: refactor fcloop_delete_local_port
Use the newly introduced fcloop_lport_lookup instead of the open coded version. Signed-off-by: Daniel Wagner <wagi@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
d54a9d7f6d
commit
fbaed6a810
|
|
@ -1256,32 +1256,32 @@ __fcloop_lport_lookup(u64 node_name, u64 port_name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct fcloop_lport *
|
||||
fcloop_lport_lookup(u64 node_name, u64 port_name)
|
||||
{
|
||||
struct fcloop_lport *lport;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&fcloop_lock, flags);
|
||||
lport = __fcloop_lport_lookup(node_name, port_name);
|
||||
spin_unlock_irqrestore(&fcloop_lock, flags);
|
||||
|
||||
return lport;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
fcloop_delete_local_port(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct fcloop_lport *tlport, *lport = NULL;
|
||||
struct fcloop_lport *lport;
|
||||
u64 nodename, portname;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
ret = fcloop_parse_nm_options(dev, &nodename, &portname, buf);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
spin_lock_irqsave(&fcloop_lock, flags);
|
||||
|
||||
list_for_each_entry(tlport, &fcloop_lports, lport_list) {
|
||||
if (tlport->localport->node_name == nodename &&
|
||||
tlport->localport->port_name == portname) {
|
||||
if (!fcloop_lport_get(tlport))
|
||||
break;
|
||||
lport = tlport;
|
||||
break;
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&fcloop_lock, flags);
|
||||
|
||||
lport = fcloop_lport_lookup(nodename, portname);
|
||||
if (!lport)
|
||||
return -ENOENT;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user