diff options
author | Andy Grover <agrover@redhat.com> | 2011-07-20 15:13:28 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 05:37:48 -0400 |
commit | 05d1c7c0d0db4cc25548d9aadebb416888a82327 (patch) | |
tree | 290243526d188a7f6a683b0e13a63c7207471fa1 /include/target | |
parent | e22a7f075226c51f3f71b922e9eeb4f99fac1475 (diff) |
target: Make all control CDBs scatter-gather
Previously, some control CDBs did not allocate memory in pages for their
data buffer, but just did a kmalloc. This patch makes all cdbs allocate
pages.
This has the benefit of streamlining some paths that had to behave
differently when we used two allocation methods. The downside is that
all accesses to the data buffer need to kmap it before use, and need to
handle data in page-sized chunks if more than a page is needed for a given
command's data buffer.
Finally, note that cdbs with no data buffers are handled a little
differently. Before, SCSI_NON_DATA_CDBs would not call get_mem at all
(they'd be in the final else in transport_allocate_resources) but now
these will make it into generic_get_mem, but just not allocate any
buffers.
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
-rw-r--r-- | include/target/target_core_base.h | 5 | ||||
-rw-r--r-- | include/target/target_core_transport.h | 6 |
2 files changed, 3 insertions, 8 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 81deb399bf6a..f67ca98394d3 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -109,7 +109,6 @@ enum se_cmd_flags_table { | |||
109 | SCF_EMULATED_TASK_SENSE = 0x00000004, | 109 | SCF_EMULATED_TASK_SENSE = 0x00000004, |
110 | SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, | 110 | SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, |
111 | SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, | 111 | SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, |
112 | SCF_SCSI_CONTROL_NONSG_IO_CDB = 0x00000020, | ||
113 | SCF_SCSI_NON_DATA_CDB = 0x00000040, | 112 | SCF_SCSI_NON_DATA_CDB = 0x00000040, |
114 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, | 113 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, |
115 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, | 114 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, |
@@ -123,7 +122,6 @@ enum se_cmd_flags_table { | |||
123 | SCF_ALUA_NON_OPTIMIZED = 0x00040000, | 122 | SCF_ALUA_NON_OPTIMIZED = 0x00040000, |
124 | SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, | 123 | SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, |
125 | SCF_UNUSED = 0x00100000, | 124 | SCF_UNUSED = 0x00100000, |
126 | SCF_PASSTHROUGH_CONTIG_TO_SG = 0x00200000, | ||
127 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, | 125 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, |
128 | SCF_EMULATE_CDB_ASYNC = 0x01000000, | 126 | SCF_EMULATE_CDB_ASYNC = 0x01000000, |
129 | SCF_EMULATE_QUEUE_FULL = 0x02000000, | 127 | SCF_EMULATE_QUEUE_FULL = 0x02000000, |
@@ -516,8 +514,7 @@ struct se_cmd { | |||
516 | struct completion transport_lun_fe_stop_comp; | 514 | struct completion transport_lun_fe_stop_comp; |
517 | struct completion transport_lun_stop_comp; | 515 | struct completion transport_lun_stop_comp; |
518 | struct scatterlist *t_tasks_sg_chained; | 516 | struct scatterlist *t_tasks_sg_chained; |
519 | struct scatterlist t_tasks_sg_bounce; | 517 | |
520 | void *t_task_buf; | ||
521 | /* | 518 | /* |
522 | * Used for pre-registered fabric SGL passthrough WRITE and READ | 519 | * Used for pre-registered fabric SGL passthrough WRITE and READ |
523 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop | 520 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop |
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index b27ce1af698b..123df9238c68 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
@@ -165,6 +165,8 @@ extern void transport_init_se_cmd(struct se_cmd *, | |||
165 | struct target_core_fabric_ops *, | 165 | struct target_core_fabric_ops *, |
166 | struct se_session *, u32, int, int, | 166 | struct se_session *, u32, int, int, |
167 | unsigned char *); | 167 | unsigned char *); |
168 | void *transport_kmap_first_data_page(struct se_cmd *cmd); | ||
169 | void transport_kunmap_first_data_page(struct se_cmd *cmd); | ||
168 | extern void transport_free_se_cmd(struct se_cmd *); | 170 | extern void transport_free_se_cmd(struct se_cmd *); |
169 | extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | 171 | extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); |
170 | extern int transport_generic_handle_cdb(struct se_cmd *); | 172 | extern int transport_generic_handle_cdb(struct se_cmd *); |
@@ -237,10 +239,6 @@ struct se_subsystem_api { | |||
237 | */ | 239 | */ |
238 | int (*cdb_none)(struct se_task *); | 240 | int (*cdb_none)(struct se_task *); |
239 | /* | 241 | /* |
240 | * For SCF_SCSI_CONTROL_NONSG_IO_CDB | ||
241 | */ | ||
242 | int (*map_task_non_SG)(struct se_task *); | ||
243 | /* | ||
244 | * For SCF_SCSI_DATA_SG_IO_CDB and SCF_SCSI_CONTROL_SG_IO_CDB | 242 | * For SCF_SCSI_DATA_SG_IO_CDB and SCF_SCSI_CONTROL_SG_IO_CDB |
245 | */ | 243 | */ |
246 | int (*map_task_SG)(struct se_task *); | 244 | int (*map_task_SG)(struct se_task *); |