summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2011-05-03 04:12:10 +0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-07-22 13:37:44 +0400
commita1d8b49abd60ba5d09e7c968731abcb0f8f1cbf6 (patch)
tree8cbfd54b4829fd5f0ed206e15c81c1e626e7701d /include
parentdd3a5ad8e0c8706659f02c4a72b8c87f6f7ab479 (diff)
downloadlinux-a1d8b49abd60ba5d09e7c968731abcb0f8f1cbf6.tar.xz
target: Updates from AGrover and HCH (round 3)
This patch contains a squashed version of third round series cleanups, improvements ,and simplfications from Andy and Christoph ahead of the heavy lifting between round 3 -> 4 for the target core SGL conversion. This include cleanups to the main target I/O path and other miscellaneous updates. target: Replace custom sg<->buf functions with lib funcs target: Simplify sector limiting code target: get_cdb should never return NULL target: Simplify transport_memcpy_se_mem_read_contig target: Use assignment rather than increment for t_task_cdbs target: Don't pass dma_size to generic_get_mem target: Pass sg with type scatterlist in transport_map_sg_to_mem target: Move task_sg_num next to task_sg in struct se_task target: inline struct se_transport_task into struct se_cmd target: Change name & semantics of transport_get_sectors() target: Remove unused members of se_cmd target: Rename se_cmd.t_task_cdbs to t_task_list_num target: Fix some spelling target: Remove unused var from transport_generic_do_tmr target: map_sg_to_mem: return sg_count in return value target/pscsi: Use min_t for sector limits target/pscsi: Unused param for pscsi_get_bio() target: Rename get_cdb_count to allocate_tasks target: Make transport_generic_new_cmd() available for iscsi-target target: Remove fabric callback to allocate iovecs target: Fix transport_generic_new_cmd WRITE comment (hch: Use __GFP_ZERO usage for alloc_pages() usage) Signed-off-by: Andy Grover <agrover@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include')
-rw-r--r--include/target/target_core_base.h105
-rw-r--r--include/target/target_core_fabric_ops.h5
-rw-r--r--include/target/target_core_transport.h3
3 files changed, 49 insertions, 64 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 94c838dcfc3c..71c96ce9287e 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -403,64 +403,10 @@ struct se_queue_obj {
wait_queue_head_t thread_wq;
} ____cacheline_aligned;
-/*
- * Used one per struct se_cmd to hold all extra struct se_task
- * metadata. This structure is setup and allocated in
- * drivers/target/target_core_transport.c:__transport_alloc_se_cmd()
- */
-struct se_transport_task {
- unsigned char *t_task_cdb;
- unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
- unsigned long long t_task_lba;
- int t_tasks_failed;
- int t_tasks_fua;
- bool t_tasks_bidi;
- u32 t_task_cdbs;
- u32 t_tasks_check;
- u32 t_tasks_no;
- u32 t_tasks_sectors;
- u32 t_tasks_se_num;
- u32 t_tasks_se_bidi_num;
- u32 t_tasks_sg_chained_no;
- atomic_t t_fe_count;
- atomic_t t_se_count;
- atomic_t t_task_cdbs_left;
- atomic_t t_task_cdbs_ex_left;
- atomic_t t_task_cdbs_timeout_left;
- atomic_t t_task_cdbs_sent;
- atomic_t t_transport_aborted;
- atomic_t t_transport_active;
- atomic_t t_transport_complete;
- atomic_t t_transport_queue_active;
- atomic_t t_transport_sent;
- atomic_t t_transport_stop;
- atomic_t t_transport_timeout;
- atomic_t transport_dev_active;
- atomic_t transport_lun_active;
- atomic_t transport_lun_fe_stop;
- atomic_t transport_lun_stop;
- spinlock_t t_state_lock;
- struct completion t_transport_stop_comp;
- struct completion transport_lun_fe_stop_comp;
- struct completion transport_lun_stop_comp;
- struct scatterlist *t_tasks_sg_chained;
- struct scatterlist t_tasks_sg_bounce;
- void *t_task_buf;
- /*
- * Used for pre-registered fabric SGL passthrough WRITE and READ
- * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop
- * and other HW target mode fabric modules.
- */
- struct scatterlist *t_task_pt_sgl;
- struct list_head t_mem_list;
- /* Used for BIDI READ */
- struct list_head t_mem_bidi_list;
- struct list_head t_task_list;
-} ____cacheline_aligned;
-
struct se_task {
unsigned char task_sense;
struct scatterlist *task_sg;
+ u32 task_sg_num;
struct scatterlist *task_sg_bidi;
u8 task_scsi_status;
u8 task_flags;
@@ -471,8 +417,6 @@ struct se_task {
u32 task_no;
u32 task_sectors;
u32 task_size;
- u32 task_sg_num;
- u32 task_sg_offset;
enum dma_data_direction task_data_direction;
struct se_cmd *task_se_cmd;
struct se_device *se_dev;
@@ -534,13 +478,58 @@ struct se_cmd {
/* Only used for internal passthrough and legacy TCM fabric modules */
struct se_session *se_sess;
struct se_tmr_req *se_tmr_req;
- struct se_transport_task t_task;
struct list_head se_queue_node;
struct target_core_fabric_ops *se_tfo;
int (*transport_emulate_cdb)(struct se_cmd *);
void (*transport_split_cdb)(unsigned long long, u32 *, unsigned char *);
void (*transport_wait_for_tasks)(struct se_cmd *, int, int);
void (*transport_complete_callback)(struct se_cmd *);
+ unsigned char *t_task_cdb;
+ unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
+ unsigned long long t_task_lba;
+ int t_tasks_failed;
+ int t_tasks_fua;
+ bool t_tasks_bidi;
+ u32 t_tasks_se_num;
+ u32 t_tasks_se_bidi_num;
+ u32 t_tasks_sg_chained_no;
+ atomic_t t_fe_count;
+ atomic_t t_se_count;
+ atomic_t t_task_cdbs_left;
+ atomic_t t_task_cdbs_ex_left;
+ atomic_t t_task_cdbs_timeout_left;
+ atomic_t t_task_cdbs_sent;
+ atomic_t t_transport_aborted;
+ atomic_t t_transport_active;
+ atomic_t t_transport_complete;
+ atomic_t t_transport_queue_active;
+ atomic_t t_transport_sent;
+ atomic_t t_transport_stop;
+ atomic_t t_transport_timeout;
+ atomic_t transport_dev_active;
+ atomic_t transport_lun_active;
+ atomic_t transport_lun_fe_stop;
+ atomic_t transport_lun_stop;
+ spinlock_t t_state_lock;
+ struct completion t_transport_stop_comp;
+ struct completion transport_lun_fe_stop_comp;
+ struct completion transport_lun_stop_comp;
+ struct scatterlist *t_tasks_sg_chained;
+ struct scatterlist t_tasks_sg_bounce;
+ void *t_task_buf;
+ /*
+ * Used for pre-registered fabric SGL passthrough WRITE and READ
+ * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop
+ * and other HW target mode fabric modules.
+ */
+ struct scatterlist *t_task_pt_sgl;
+ u32 t_task_pt_sgl_num;
+ struct list_head t_mem_list;
+ /* Used for BIDI READ */
+ struct list_head t_mem_bidi_list;
+ struct list_head t_task_list;
+ u32 t_task_list_num;
+
} ____cacheline_aligned;
struct se_tmr_req {
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric_ops.h
index 747e1404dca0..1752ed3f77fa 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric_ops.h
@@ -39,11 +39,6 @@ struct target_core_fabric_ops {
*/
int (*new_cmd_map)(struct se_cmd *);
/*
- * Optional function pointer for TCM fabric modules that use
- * Linux/NET sockets to allocate struct iovec array to struct se_cmd
- */
- int (*alloc_cmd_iovecs)(struct se_cmd *);
- /*
* Optional to release struct se_cmd and fabric dependent allocated
* I/O descriptor in transport_cmd_check_stop()
*/
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index acd591491767..c9846d521945 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -184,10 +184,11 @@ extern void transport_generic_free_cmd(struct se_cmd *, int, int, int);
extern void transport_generic_wait_for_cmds(struct se_cmd *, int);
extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32);
extern int transport_map_mem_to_sg(struct se_task *, struct list_head *,
- void *, struct se_mem *,
+ struct scatterlist *, struct se_mem *,
struct se_mem **, u32 *, u32 *);
extern void transport_do_task_sg_chain(struct se_cmd *);
extern void transport_generic_process_write(struct se_cmd *);
+extern int transport_generic_new_cmd(struct se_cmd *);
extern int transport_generic_do_tmr(struct se_cmd *);
/* From target_core_alua.c */
extern int core_alua_check_nonop_delay(struct se_cmd *);