fcst: Builds again on kernel 3.0 and before (merge r4107 and r4108 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4231 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-04-25 10:04:37 +00:00
parent cc5422a900
commit 3ee53839eb

View File

@@ -78,6 +78,18 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)
return tport;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
/*
* Free tport via RCU.
*/
static void ft_tport_rcu_free(struct rcu_head *rcu)
{
struct ft_tport *tport = container_of(rcu, struct ft_tport, rcu);
kfree(tport);
}
#endif
/*
* Delete target local port, if any, associated with the local port.
* Caller holds ft_lport_lock.
@@ -95,7 +107,11 @@ static void ft_tport_delete(struct ft_tport *tport)
BUG_ON(tport != lport->prov[FC_TYPE_FCP]);
rcu_assign_pointer(lport->prov[FC_TYPE_FCP], NULL);
tport->lport = NULL;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
kfree_rcu(tport, rcu);
#else
call_rcu(&tport->rcu, ft_tport_rcu_free);
#endif
ft_tport_count--;
}