diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-09 15:42:09 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-09 18:08:47 -0400 |
commit | 11e764bd5ed4bb930e0ec5dd161df58307507347 (patch) | |
tree | fa753a950d19c2ef848c50c60f71019dcb912e74 /drivers/target/target_core_device.c | |
parent | 2301917044b96fda41f794011368e623a9b7a435 (diff) |
target: Remove max_sectors device attribute for modern se_task less code
This patch removes the original usage of dev_attr->max_sectors in favor of
dev_attr->hw_max_sectors that is now being enforced by target core from
within transport_generic_cmd_sequencer() for SCF_SCSI_DATA_SG_IO_CDB ops.
After the recent se_task removal patches from hch, this value for IBLOCK
backends being set via configfs by userspace from an saved max_sectors
value that is turning out to be problematic, so it makes sense to go ahead
and remove this now legacy attribute all-together.
This patch also continues to make se_dev_set_default_attribs() do
(sectors / block_size) alignment for what actually get used by
target_core_mod to be safe here, following the same alignment currently
used by fabric_max_sectors.
Reported-by: Andy Grover <agrover@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r-- | drivers/target/target_core_device.c | 69 |
1 files changed, 4 insertions, 65 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index e621350feebc..5ad972856a8d 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -876,15 +876,12 @@ void se_dev_set_default_attribs( | |||
876 | dev->se_sub_dev->se_dev_attrib.hw_block_size = limits->logical_block_size; | 876 | dev->se_sub_dev->se_dev_attrib.hw_block_size = limits->logical_block_size; |
877 | dev->se_sub_dev->se_dev_attrib.block_size = limits->logical_block_size; | 877 | dev->se_sub_dev->se_dev_attrib.block_size = limits->logical_block_size; |
878 | /* | 878 | /* |
879 | * max_sectors is based on subsystem plugin dependent requirements. | 879 | * Align max_hw_sectors down to PAGE_SIZE I/O transfers |
880 | */ | 880 | */ |
881 | dev->se_sub_dev->se_dev_attrib.hw_max_sectors = limits->max_hw_sectors; | 881 | limits->max_hw_sectors = se_dev_align_max_sectors(limits->max_hw_sectors, |
882 | /* | ||
883 | * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() | ||
884 | */ | ||
885 | limits->max_sectors = se_dev_align_max_sectors(limits->max_sectors, | ||
886 | limits->logical_block_size); | 882 | limits->logical_block_size); |
887 | dev->se_sub_dev->se_dev_attrib.max_sectors = limits->max_sectors; | 883 | dev->se_sub_dev->se_dev_attrib.hw_max_sectors = limits->max_hw_sectors; |
884 | |||
888 | /* | 885 | /* |
889 | * Set fabric_max_sectors, which is reported in block limits | 886 | * Set fabric_max_sectors, which is reported in block limits |
890 | * VPD page (B0h). | 887 | * VPD page (B0h). |
@@ -1168,64 +1165,6 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 queue_depth) | |||
1168 | return 0; | 1165 | return 0; |
1169 | } | 1166 | } |
1170 | 1167 | ||
1171 | int se_dev_set_max_sectors(struct se_device *dev, u32 max_sectors) | ||
1172 | { | ||
1173 | int force = 0; /* Force setting for VDEVS */ | ||
1174 | |||
1175 | if (atomic_read(&dev->dev_export_obj.obj_access_count)) { | ||
1176 | pr_err("dev[%p]: Unable to change SE Device" | ||
1177 | " max_sectors while dev_export_obj: %d count exists\n", | ||
1178 | dev, atomic_read(&dev->dev_export_obj.obj_access_count)); | ||
1179 | return -EINVAL; | ||
1180 | } | ||
1181 | if (!max_sectors) { | ||
1182 | pr_err("dev[%p]: Illegal ZERO value for" | ||
1183 | " max_sectors\n", dev); | ||
1184 | return -EINVAL; | ||
1185 | } | ||
1186 | if (max_sectors < DA_STATUS_MAX_SECTORS_MIN) { | ||
1187 | pr_err("dev[%p]: Passed max_sectors: %u less than" | ||
1188 | " DA_STATUS_MAX_SECTORS_MIN: %u\n", dev, max_sectors, | ||
1189 | DA_STATUS_MAX_SECTORS_MIN); | ||
1190 | return -EINVAL; | ||
1191 | } | ||
1192 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) { | ||
1193 | if (max_sectors > dev->se_sub_dev->se_dev_attrib.hw_max_sectors) { | ||
1194 | pr_err("dev[%p]: Passed max_sectors: %u" | ||
1195 | " greater than TCM/SE_Device max_sectors:" | ||
1196 | " %u\n", dev, max_sectors, | ||
1197 | dev->se_sub_dev->se_dev_attrib.hw_max_sectors); | ||
1198 | return -EINVAL; | ||
1199 | } | ||
1200 | } else { | ||
1201 | if (!force && (max_sectors > | ||
1202 | dev->se_sub_dev->se_dev_attrib.hw_max_sectors)) { | ||
1203 | pr_err("dev[%p]: Passed max_sectors: %u" | ||
1204 | " greater than TCM/SE_Device max_sectors" | ||
1205 | ": %u, use force=1 to override.\n", dev, | ||
1206 | max_sectors, dev->se_sub_dev->se_dev_attrib.hw_max_sectors); | ||
1207 | return -EINVAL; | ||
1208 | } | ||
1209 | if (max_sectors > DA_STATUS_MAX_SECTORS_MAX) { | ||
1210 | pr_err("dev[%p]: Passed max_sectors: %u" | ||
1211 | " greater than DA_STATUS_MAX_SECTORS_MAX:" | ||
1212 | " %u\n", dev, max_sectors, | ||
1213 | DA_STATUS_MAX_SECTORS_MAX); | ||
1214 | return -EINVAL; | ||
1215 | } | ||
1216 | } | ||
1217 | /* | ||
1218 | * Align max_sectors down to PAGE_SIZE to follow transport_allocate_data_tasks() | ||
1219 | */ | ||
1220 | max_sectors = se_dev_align_max_sectors(max_sectors, | ||
1221 | dev->se_sub_dev->se_dev_attrib.block_size); | ||
1222 | |||
1223 | dev->se_sub_dev->se_dev_attrib.max_sectors = max_sectors; | ||
1224 | pr_debug("dev[%p]: SE Device max_sectors changed to %u\n", | ||
1225 | dev, max_sectors); | ||
1226 | return 0; | ||
1227 | } | ||
1228 | |||
1229 | int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors) | 1168 | int se_dev_set_fabric_max_sectors(struct se_device *dev, u32 fabric_max_sectors) |
1230 | { | 1169 | { |
1231 | if (atomic_read(&dev->dev_export_obj.obj_access_count)) { | 1170 | if (atomic_read(&dev->dev_export_obj.obj_access_count)) { |