hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/target/target_core_tpg.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*******************************************************************************
23 * Filename: target_core_tpg.c
34 *
....@@ -6,20 +7,6 @@
67 * (c) Copyright 2002-2013 Datera, Inc.
78 *
89 * Nicholas A. Bellinger <nab@kernel.org>
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2310 *
2411 ******************************************************************************/
2512
....@@ -44,9 +31,6 @@
4431 #include "target_core_ua.h"
4532
4633 extern struct se_device *g_lun0_dev;
47
-
48
-static DEFINE_SPINLOCK(tpg_lock);
49
-static LIST_HEAD(tpg_list);
5034
5135 /* __core_tpg_get_initiator_node_acl():
5236 *
....@@ -151,7 +135,7 @@
151135
152136 pr_debug("TARGET_CORE[%s]->TPG[%u]_LUN[%llu] - Adding %s"
153137 " access for LUN in Demo Mode\n",
154
- tpg->se_tpg_tfo->get_fabric_name(),
138
+ tpg->se_tpg_tfo->fabric_name,
155139 tpg->se_tpg_tfo->tpg_get_tag(tpg), lun->unpacked_lun,
156140 lun_access_ro ? "READ-ONLY" : "READ-WRITE");
157141
....@@ -176,7 +160,7 @@
176160
177161 if (!acl->queue_depth) {
178162 pr_warn("Queue depth for %s Initiator Node: %s is 0,"
179
- "defaulting to 1.\n", tpg->se_tpg_tfo->get_fabric_name(),
163
+ "defaulting to 1.\n", tpg->se_tpg_tfo->fabric_name,
180164 acl->initiatorname);
181165 acl->queue_depth = 1;
182166 }
....@@ -227,11 +211,11 @@
227211
228212 pr_debug("%s_TPG[%hu] - Added %s ACL with TCQ Depth: %d for %s"
229213 " Initiator Node: %s\n",
230
- tpg->se_tpg_tfo->get_fabric_name(),
214
+ tpg->se_tpg_tfo->fabric_name,
231215 tpg->se_tpg_tfo->tpg_get_tag(tpg),
232216 acl->dynamic_node_acl ? "DYNAMIC" : "",
233217 acl->queue_depth,
234
- tpg->se_tpg_tfo->get_fabric_name(),
218
+ tpg->se_tpg_tfo->fabric_name,
235219 acl->initiatorname);
236220 }
237221
....@@ -313,7 +297,7 @@
313297 if (acl->dynamic_node_acl) {
314298 acl->dynamic_node_acl = 0;
315299 pr_debug("%s_TPG[%u] - Replacing dynamic ACL"
316
- " for %s\n", tpg->se_tpg_tfo->get_fabric_name(),
300
+ " for %s\n", tpg->se_tpg_tfo->fabric_name,
317301 tpg->se_tpg_tfo->tpg_get_tag(tpg), initiatorname);
318302 mutex_unlock(&tpg->acl_node_mutex);
319303 return acl;
....@@ -321,7 +305,7 @@
321305
322306 pr_err("ACL entry for %s Initiator"
323307 " Node %s already exists for TPG %u, ignoring"
324
- " request.\n", tpg->se_tpg_tfo->get_fabric_name(),
308
+ " request.\n", tpg->se_tpg_tfo->fabric_name,
325309 initiatorname, tpg->se_tpg_tfo->tpg_get_tag(tpg));
326310 mutex_unlock(&tpg->acl_node_mutex);
327311 return ERR_PTR(-EEXIST);
....@@ -380,9 +364,9 @@
380364 core_free_device_list_for_node(acl, tpg);
381365
382366 pr_debug("%s_TPG[%hu] - Deleted ACL with TCQ Depth: %d for %s"
383
- " Initiator Node: %s\n", tpg->se_tpg_tfo->get_fabric_name(),
367
+ " Initiator Node: %s\n", tpg->se_tpg_tfo->fabric_name,
384368 tpg->se_tpg_tfo->tpg_get_tag(tpg), acl->queue_depth,
385
- tpg->se_tpg_tfo->get_fabric_name(), acl->initiatorname);
369
+ tpg->se_tpg_tfo->fabric_name, acl->initiatorname);
386370
387371 kfree(acl);
388372 }
....@@ -418,7 +402,7 @@
418402
419403 pr_debug("Successfully changed queue depth to: %d for Initiator"
420404 " Node: %s on %s Target Portal Group: %u\n", acl->queue_depth,
421
- acl->initiatorname, tpg->se_tpg_tfo->get_fabric_name(),
405
+ acl->initiatorname, tpg->se_tpg_tfo->fabric_name,
422406 tpg->se_tpg_tfo->tpg_get_tag(tpg));
423407
424408 return 0;
....@@ -488,7 +472,6 @@
488472 se_tpg->se_tpg_wwn = se_wwn;
489473 atomic_set(&se_tpg->tpg_pr_ref_count, 0);
490474 INIT_LIST_HEAD(&se_tpg->acl_node_list);
491
- INIT_LIST_HEAD(&se_tpg->se_tpg_node);
492475 INIT_LIST_HEAD(&se_tpg->tpg_sess_list);
493476 spin_lock_init(&se_tpg->session_lock);
494477 mutex_init(&se_tpg->tpg_lun_mutex);
....@@ -507,12 +490,8 @@
507490 }
508491 }
509492
510
- spin_lock_bh(&tpg_lock);
511
- list_add_tail(&se_tpg->se_tpg_node, &tpg_list);
512
- spin_unlock_bh(&tpg_lock);
513
-
514493 pr_debug("TARGET_CORE[%s]: Allocated portal_group for endpoint: %s, "
515
- "Proto: %d, Portal Tag: %u\n", se_tpg->se_tpg_tfo->get_fabric_name(),
494
+ "Proto: %d, Portal Tag: %u\n", se_tpg->se_tpg_tfo->fabric_name,
516495 se_tpg->se_tpg_tfo->tpg_get_wwn(se_tpg) ?
517496 se_tpg->se_tpg_tfo->tpg_get_wwn(se_tpg) : NULL,
518497 se_tpg->proto_id, se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg));
....@@ -528,13 +507,9 @@
528507 LIST_HEAD(node_list);
529508
530509 pr_debug("TARGET_CORE[%s]: Deallocating portal_group for endpoint: %s, "
531
- "Proto: %d, Portal Tag: %u\n", tfo->get_fabric_name(),
510
+ "Proto: %d, Portal Tag: %u\n", tfo->fabric_name,
532511 tfo->tpg_get_wwn(se_tpg) ? tfo->tpg_get_wwn(se_tpg) : NULL,
533512 se_tpg->proto_id, tfo->tpg_get_tag(se_tpg));
534
-
535
- spin_lock_bh(&tpg_lock);
536
- list_del(&se_tpg->se_tpg_node);
537
- spin_unlock_bh(&tpg_lock);
538513
539514 while (atomic_read(&se_tpg->tpg_pr_ref_count) != 0)
540515 cpu_relax();
....@@ -577,7 +552,6 @@
577552 }
578553 lun->unpacked_lun = unpacked_lun;
579554 atomic_set(&lun->lun_acl_count, 0);
580
- init_completion(&lun->lun_ref_comp);
581555 init_completion(&lun->lun_shutdown_comp);
582556 INIT_LIST_HEAD(&lun->lun_deve_list);
583557 INIT_LIST_HEAD(&lun->lun_dev_link);
....@@ -608,8 +582,7 @@
608582 if (ret)
609583 goto out_kill_ref;
610584
611
- if (!(dev->transport->transport_flags &
612
- TRANSPORT_FLAG_PASSTHROUGH_ALUA) &&
585
+ if (!(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_ALUA) &&
613586 !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE))
614587 target_attach_tg_pt_gp(lun, dev->t10_alua.default_tg_pt_gp);
615588