diff options
author | Hannes Reinecke <hare@suse.de> | 2015-06-10 02:41:23 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-06-16 02:26:03 -0400 |
commit | 196e2e2aa362850bf45bcb14b9517124b23b921e (patch) | |
tree | 65be24d2b0d650afe59e69c4749a853ebaa3ee0e | |
parent | f2d30680204f20b815e6796437923fb870b6c193 (diff) |
target: Remove TARGET_MAX_LUNS_PER_TRANSPORT
LUN allocation is now fully dynamic, so there is no need to
artificially restrain the number of exported LUNs.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_device.c | 9 | ||||
-rw-r--r-- | drivers/target/target_core_fabric_configfs.c | 8 | ||||
-rw-r--r-- | drivers/target/target_core_tpg.c | 9 | ||||
-rw-r--r-- | drivers/xen/xen-scsiback.c | 7 | ||||
-rw-r--r-- | include/target/target_core_base.h | 3 |
5 files changed, 4 insertions, 32 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 2ea7322c4dd4..ed084023e7d4 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -63,9 +63,6 @@ transport_lookup_cmd_lun(struct se_cmd *se_cmd, u64 unpacked_lun) | |||
63 | struct se_node_acl *nacl = se_sess->se_node_acl; | 63 | struct se_node_acl *nacl = se_sess->se_node_acl; |
64 | struct se_dev_entry *deve; | 64 | struct se_dev_entry *deve; |
65 | 65 | ||
66 | if (unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) | ||
67 | return TCM_NON_EXISTENT_LUN; | ||
68 | |||
69 | rcu_read_lock(); | 66 | rcu_read_lock(); |
70 | deve = target_nacl_find_deve(nacl, unpacked_lun); | 67 | deve = target_nacl_find_deve(nacl, unpacked_lun); |
71 | if (deve) { | 68 | if (deve) { |
@@ -156,9 +153,6 @@ int transport_lookup_tmr_lun(struct se_cmd *se_cmd, u64 unpacked_lun) | |||
156 | struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; | 153 | struct se_tmr_req *se_tmr = se_cmd->se_tmr_req; |
157 | unsigned long flags; | 154 | unsigned long flags; |
158 | 155 | ||
159 | if (unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) | ||
160 | return -ENODEV; | ||
161 | |||
162 | rcu_read_lock(); | 156 | rcu_read_lock(); |
163 | deve = target_nacl_find_deve(nacl, unpacked_lun); | 157 | deve = target_nacl_find_deve(nacl, unpacked_lun); |
164 | if (deve) { | 158 | if (deve) { |
@@ -197,9 +191,6 @@ bool target_lun_is_rdonly(struct se_cmd *cmd) | |||
197 | struct se_dev_entry *deve; | 191 | struct se_dev_entry *deve; |
198 | bool ret; | 192 | bool ret; |
199 | 193 | ||
200 | if (cmd->se_lun->lun_access & TRANSPORT_LUNFLAGS_READ_ONLY) | ||
201 | return true; | ||
202 | |||
203 | rcu_read_lock(); | 194 | rcu_read_lock(); |
204 | deve = target_nacl_find_deve(se_sess->se_node_acl, cmd->orig_fe_lun); | 195 | deve = target_nacl_find_deve(se_sess->se_node_acl, cmd->orig_fe_lun); |
205 | ret = (deve && deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY); | 196 | ret = (deve && deve->lun_flags & TRANSPORT_LUNFLAGS_READ_ONLY); |
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c index 2fd493e416b0..6cfee595f3f2 100644 --- a/drivers/target/target_core_fabric_configfs.c +++ b/drivers/target/target_core_fabric_configfs.c | |||
@@ -353,14 +353,6 @@ static struct config_group *target_fabric_make_mappedlun( | |||
353 | ret = kstrtoull(buf + 4, 0, &mapped_lun); | 353 | ret = kstrtoull(buf + 4, 0, &mapped_lun); |
354 | if (ret) | 354 | if (ret) |
355 | goto out; | 355 | goto out; |
356 | if (mapped_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) { | ||
357 | pr_err("Mapped LUN: %llu exceeds TRANSPORT_MAX_LUNS_PER_TPG" | ||
358 | "-1: %u for Target Portal Group: %u\n", mapped_lun, | ||
359 | TRANSPORT_MAX_LUNS_PER_TPG-1, | ||
360 | se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg)); | ||
361 | ret = -EINVAL; | ||
362 | goto out; | ||
363 | } | ||
364 | 356 | ||
365 | lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl, | 357 | lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl, |
366 | mapped_lun, &ret); | 358 | mapped_lun, &ret); |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 82ed8a0f3f0e..aa39bc89227b 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
@@ -602,15 +602,6 @@ struct se_lun *core_tpg_alloc_lun( | |||
602 | { | 602 | { |
603 | struct se_lun *lun; | 603 | struct se_lun *lun; |
604 | 604 | ||
605 | if (unpacked_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) { | ||
606 | pr_err("%s LUN: %llu exceeds TRANSPORT_MAX_LUNS_PER_TPG" | ||
607 | "-1: %u for Target Portal Group: %u\n", | ||
608 | tpg->se_tpg_tfo->get_fabric_name(), | ||
609 | unpacked_lun, TRANSPORT_MAX_LUNS_PER_TPG-1, | ||
610 | tpg->se_tpg_tfo->tpg_get_tag(tpg)); | ||
611 | return ERR_PTR(-EOVERFLOW); | ||
612 | } | ||
613 | |||
614 | lun = kzalloc(sizeof(*lun), GFP_KERNEL); | 605 | lun = kzalloc(sizeof(*lun), GFP_KERNEL); |
615 | if (!lun) { | 606 | if (!lun) { |
616 | pr_err("Unable to allocate se_lun memory\n"); | 607 | pr_err("Unable to allocate se_lun memory\n"); |
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 25144a0ff07c..10d67802a2fb 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c | |||
@@ -864,7 +864,7 @@ static int scsiback_add_translation_entry(struct vscsibk_info *info, | |||
864 | struct list_head *head = &(info->v2p_entry_lists); | 864 | struct list_head *head = &(info->v2p_entry_lists); |
865 | unsigned long flags; | 865 | unsigned long flags; |
866 | char *lunp; | 866 | char *lunp; |
867 | unsigned int unpacked_lun; | 867 | unsigned long long unpacked_lun; |
868 | struct se_lun *se_lun; | 868 | struct se_lun *se_lun; |
869 | struct scsiback_tpg *tpg_entry, *tpg = NULL; | 869 | struct scsiback_tpg *tpg_entry, *tpg = NULL; |
870 | char *error = "doesn't exist"; | 870 | char *error = "doesn't exist"; |
@@ -876,9 +876,10 @@ static int scsiback_add_translation_entry(struct vscsibk_info *info, | |||
876 | } | 876 | } |
877 | *lunp = 0; | 877 | *lunp = 0; |
878 | lunp++; | 878 | lunp++; |
879 | if (kstrtouint(lunp, 10, &unpacked_lun) || unpacked_lun >= TRANSPORT_MAX_LUNS_PER_TPG) { | 879 | err = kstrtoull(lunp, 10, &unpacked_lun); |
880 | if (err < 0) { | ||
880 | pr_err("lun number not valid: %s\n", lunp); | 881 | pr_err("lun number not valid: %s\n", lunp); |
881 | return -EINVAL; | 882 | return err; |
882 | } | 883 | } |
883 | 884 | ||
884 | mutex_lock(&scsiback_mutex); | 885 | mutex_lock(&scsiback_mutex); |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 836ff8abdf18..8cb612613c10 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -13,9 +13,6 @@ | |||
13 | #define TARGET_CORE_MOD_VERSION "v4.1.0" | 13 | #define TARGET_CORE_MOD_VERSION "v4.1.0" |
14 | #define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION | 14 | #define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION |
15 | 15 | ||
16 | /* Maximum Number of LUNs per Target Portal Group */ | ||
17 | /* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ | ||
18 | #define TRANSPORT_MAX_LUNS_PER_TPG 256 | ||
19 | /* | 16 | /* |
20 | * By default we use 32-byte CDBs in TCM Core and subsystem plugin code. | 17 | * By default we use 32-byte CDBs in TCM Core and subsystem plugin code. |
21 | * | 18 | * |