diff options
| author | Andy Grover <agrover@redhat.com> | 2011-05-02 20:12:10 -0400 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 05:37:44 -0400 |
| commit | a1d8b49abd60ba5d09e7c968731abcb0f8f1cbf6 (patch) | |
| tree | 8cbfd54b4829fd5f0ed206e15c81c1e626e7701d /include | |
| parent | dd3a5ad8e0c8706659f02c4a72b8c87f6f7ab479 (diff) | |
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.h | 105 | ||||
| -rw-r--r-- | include/target/target_core_fabric_ops.h | 5 | ||||
| -rw-r--r-- | include/target/target_core_transport.h | 3 |
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 { | |||
| 403 | wait_queue_head_t thread_wq; | 403 | wait_queue_head_t thread_wq; |
| 404 | } ____cacheline_aligned; | 404 | } ____cacheline_aligned; |
| 405 | 405 | ||
| 406 | /* | ||
| 407 | * Used one per struct se_cmd to hold all extra struct se_task | ||
| 408 | * metadata. This structure is setup and allocated in | ||
| 409 | * drivers/target/target_core_transport.c:__transport_alloc_se_cmd() | ||
| 410 | */ | ||
| 411 | struct se_transport_task { | ||
| 412 | unsigned char *t_task_cdb; | ||
| 413 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | ||
| 414 | unsigned long long t_task_lba; | ||
| 415 | int t_tasks_failed; | ||
| 416 | int t_tasks_fua; | ||
| 417 | bool t_tasks_bidi; | ||
| 418 | u32 t_task_cdbs; | ||
| 419 | u32 t_tasks_check; | ||
| 420 | u32 t_tasks_no; | ||
| 421 | u32 t_tasks_sectors; | ||
| 422 | u32 t_tasks_se_num; | ||
| 423 | u32 t_tasks_se_bidi_num; | ||
| 424 | u32 t_tasks_sg_chained_no; | ||
| 425 | atomic_t t_fe_count; | ||
| 426 | atomic_t t_se_count; | ||
| 427 | atomic_t t_task_cdbs_left; | ||
| 428 | atomic_t t_task_cdbs_ex_left; | ||
| 429 | atomic_t t_task_cdbs_timeout_left; | ||
| 430 | atomic_t t_task_cdbs_sent; | ||
| 431 | atomic_t t_transport_aborted; | ||
| 432 | atomic_t t_transport_active; | ||
| 433 | atomic_t t_transport_complete; | ||
| 434 | atomic_t t_transport_queue_active; | ||
| 435 | atomic_t t_transport_sent; | ||
| 436 | atomic_t t_transport_stop; | ||
| 437 | atomic_t t_transport_timeout; | ||
| 438 | atomic_t transport_dev_active; | ||
| 439 | atomic_t transport_lun_active; | ||
| 440 | atomic_t transport_lun_fe_stop; | ||
| 441 | atomic_t transport_lun_stop; | ||
| 442 | spinlock_t t_state_lock; | ||
| 443 | struct completion t_transport_stop_comp; | ||
| 444 | struct completion transport_lun_fe_stop_comp; | ||
| 445 | struct completion transport_lun_stop_comp; | ||
| 446 | struct scatterlist *t_tasks_sg_chained; | ||
| 447 | struct scatterlist t_tasks_sg_bounce; | ||
| 448 | void *t_task_buf; | ||
| 449 | /* | ||
| 450 | * Used for pre-registered fabric SGL passthrough WRITE and READ | ||
| 451 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop | ||
| 452 | * and other HW target mode fabric modules. | ||
| 453 | */ | ||
| 454 | struct scatterlist *t_task_pt_sgl; | ||
| 455 | struct list_head t_mem_list; | ||
| 456 | /* Used for BIDI READ */ | ||
| 457 | struct list_head t_mem_bidi_list; | ||
| 458 | struct list_head t_task_list; | ||
| 459 | } ____cacheline_aligned; | ||
| 460 | |||
| 461 | struct se_task { | 406 | struct se_task { |
| 462 | unsigned char task_sense; | 407 | unsigned char task_sense; |
| 463 | struct scatterlist *task_sg; | 408 | struct scatterlist *task_sg; |
| 409 | u32 task_sg_num; | ||
| 464 | struct scatterlist *task_sg_bidi; | 410 | struct scatterlist *task_sg_bidi; |
| 465 | u8 task_scsi_status; | 411 | u8 task_scsi_status; |
| 466 | u8 task_flags; | 412 | u8 task_flags; |
| @@ -471,8 +417,6 @@ struct se_task { | |||
| 471 | u32 task_no; | 417 | u32 task_no; |
| 472 | u32 task_sectors; | 418 | u32 task_sectors; |
| 473 | u32 task_size; | 419 | u32 task_size; |
| 474 | u32 task_sg_num; | ||
| 475 | u32 task_sg_offset; | ||
| 476 | enum dma_data_direction task_data_direction; | 420 | enum dma_data_direction task_data_direction; |
| 477 | struct se_cmd *task_se_cmd; | 421 | struct se_cmd *task_se_cmd; |
| 478 | struct se_device *se_dev; | 422 | struct se_device *se_dev; |
| @@ -534,13 +478,58 @@ struct se_cmd { | |||
| 534 | /* Only used for internal passthrough and legacy TCM fabric modules */ | 478 | /* Only used for internal passthrough and legacy TCM fabric modules */ |
| 535 | struct se_session *se_sess; | 479 | struct se_session *se_sess; |
| 536 | struct se_tmr_req *se_tmr_req; | 480 | struct se_tmr_req *se_tmr_req; |
| 537 | struct se_transport_task t_task; | ||
| 538 | struct list_head se_queue_node; | 481 | struct list_head se_queue_node; |
| 539 | struct target_core_fabric_ops *se_tfo; | 482 | struct target_core_fabric_ops *se_tfo; |
| 540 | int (*transport_emulate_cdb)(struct se_cmd *); | 483 | int (*transport_emulate_cdb)(struct se_cmd *); |
| 541 | void (*transport_split_cdb)(unsigned long long, u32 *, unsigned char *); | 484 | void (*transport_split_cdb)(unsigned long long, u32 *, unsigned char *); |
| 542 | void (*transport_wait_for_tasks)(struct se_cmd *, int, int); | 485 | void (*transport_wait_for_tasks)(struct se_cmd *, int, int); |
| 543 | void (*transport_complete_callback)(struct se_cmd *); | 486 | void (*transport_complete_callback)(struct se_cmd *); |
| 487 | unsigned char *t_task_cdb; | ||
| 488 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | ||
| 489 | unsigned long long t_task_lba; | ||
| 490 | int t_tasks_failed; | ||
| 491 | int t_tasks_fua; | ||
| 492 | bool t_tasks_bidi; | ||
| 493 | u32 t_tasks_se_num; | ||
| 494 | u32 t_tasks_se_bidi_num; | ||
| 495 | u32 t_tasks_sg_chained_no; | ||
| 496 | atomic_t t_fe_count; | ||
| 497 | atomic_t t_se_count; | ||
| 498 | atomic_t t_task_cdbs_left; | ||
| 499 | atomic_t t_task_cdbs_ex_left; | ||
| 500 | atomic_t t_task_cdbs_timeout_left; | ||
| 501 | atomic_t t_task_cdbs_sent; | ||
| 502 | atomic_t t_transport_aborted; | ||
| 503 | atomic_t t_transport_active; | ||
| 504 | atomic_t t_transport_complete; | ||
| 505 | atomic_t t_transport_queue_active; | ||
| 506 | atomic_t t_transport_sent; | ||
| 507 | atomic_t t_transport_stop; | ||
| 508 | atomic_t t_transport_timeout; | ||
| 509 | atomic_t transport_dev_active; | ||
| 510 | atomic_t transport_lun_active; | ||
| 511 | atomic_t transport_lun_fe_stop; | ||
| 512 | atomic_t transport_lun_stop; | ||
| 513 | spinlock_t t_state_lock; | ||
| 514 | struct completion t_transport_stop_comp; | ||
| 515 | struct completion transport_lun_fe_stop_comp; | ||
| 516 | struct completion transport_lun_stop_comp; | ||
| 517 | struct scatterlist *t_tasks_sg_chained; | ||
| 518 | struct scatterlist t_tasks_sg_bounce; | ||
| 519 | void *t_task_buf; | ||
| 520 | /* | ||
| 521 | * Used for pre-registered fabric SGL passthrough WRITE and READ | ||
| 522 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop | ||
| 523 | * and other HW target mode fabric modules. | ||
| 524 | */ | ||
| 525 | struct scatterlist *t_task_pt_sgl; | ||
| 526 | u32 t_task_pt_sgl_num; | ||
| 527 | struct list_head t_mem_list; | ||
| 528 | /* Used for BIDI READ */ | ||
| 529 | struct list_head t_mem_bidi_list; | ||
| 530 | struct list_head t_task_list; | ||
| 531 | u32 t_task_list_num; | ||
| 532 | |||
| 544 | } ____cacheline_aligned; | 533 | } ____cacheline_aligned; |
| 545 | 534 | ||
| 546 | struct se_tmr_req { | 535 | 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 { | |||
| 39 | */ | 39 | */ |
| 40 | int (*new_cmd_map)(struct se_cmd *); | 40 | int (*new_cmd_map)(struct se_cmd *); |
| 41 | /* | 41 | /* |
| 42 | * Optional function pointer for TCM fabric modules that use | ||
| 43 | * Linux/NET sockets to allocate struct iovec array to struct se_cmd | ||
| 44 | */ | ||
| 45 | int (*alloc_cmd_iovecs)(struct se_cmd *); | ||
| 46 | /* | ||
| 47 | * Optional to release struct se_cmd and fabric dependent allocated | 42 | * Optional to release struct se_cmd and fabric dependent allocated |
| 48 | * I/O descriptor in transport_cmd_check_stop() | 43 | * I/O descriptor in transport_cmd_check_stop() |
| 49 | */ | 44 | */ |
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); | |||
| 184 | extern void transport_generic_wait_for_cmds(struct se_cmd *, int); | 184 | extern void transport_generic_wait_for_cmds(struct se_cmd *, int); |
| 185 | extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32); | 185 | extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32); |
| 186 | extern int transport_map_mem_to_sg(struct se_task *, struct list_head *, | 186 | extern int transport_map_mem_to_sg(struct se_task *, struct list_head *, |
| 187 | void *, struct se_mem *, | 187 | struct scatterlist *, struct se_mem *, |
| 188 | struct se_mem **, u32 *, u32 *); | 188 | struct se_mem **, u32 *, u32 *); |
| 189 | extern void transport_do_task_sg_chain(struct se_cmd *); | 189 | extern void transport_do_task_sg_chain(struct se_cmd *); |
| 190 | extern void transport_generic_process_write(struct se_cmd *); | 190 | extern void transport_generic_process_write(struct se_cmd *); |
| 191 | extern int transport_generic_new_cmd(struct se_cmd *); | ||
| 191 | extern int transport_generic_do_tmr(struct se_cmd *); | 192 | extern int transport_generic_do_tmr(struct se_cmd *); |
| 192 | /* From target_core_alua.c */ | 193 | /* From target_core_alua.c */ |
| 193 | extern int core_alua_check_nonop_delay(struct se_cmd *); | 194 | extern int core_alua_check_nonop_delay(struct se_cmd *); |
