khugepaged: ignore pmd tables with THP mapped with ptes
[linux/fpc-iii.git] / drivers / target / iscsi / iscsi_target_transport.c
blob08217d62fb0d6860e40bcb9fa4b2947e710b3bd4
1 #include <linux/spinlock.h>
2 #include <linux/list.h>
3 #include <target/iscsi/iscsi_transport.h>
5 static LIST_HEAD(g_transport_list);
6 static DEFINE_MUTEX(transport_mutex);
8 struct iscsit_transport *iscsit_get_transport(int type)
10 struct iscsit_transport *t;
12 mutex_lock(&transport_mutex);
13 list_for_each_entry(t, &g_transport_list, t_node) {
14 if (t->transport_type == type) {
15 if (t->owner && !try_module_get(t->owner)) {
16 t = NULL;
18 mutex_unlock(&transport_mutex);
19 return t;
22 mutex_unlock(&transport_mutex);
24 return NULL;
27 void iscsit_put_transport(struct iscsit_transport *t)
29 module_put(t->owner);
32 int iscsit_register_transport(struct iscsit_transport *t)
34 INIT_LIST_HEAD(&t->t_node);
36 mutex_lock(&transport_mutex);
37 list_add_tail(&t->t_node, &g_transport_list);
38 mutex_unlock(&transport_mutex);
40 pr_debug("Registered iSCSI transport: %s\n", t->name);
42 return 0;
44 EXPORT_SYMBOL(iscsit_register_transport);
46 void iscsit_unregister_transport(struct iscsit_transport *t)
48 mutex_lock(&transport_mutex);
49 list_del(&t->t_node);
50 mutex_unlock(&transport_mutex);
52 pr_debug("Unregistered iSCSI transport: %s\n", t->name);
54 EXPORT_SYMBOL(iscsit_unregister_transport);