diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-06-23 17:33:48 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:51 -0400 |
commit | 38d8879baeb61b6946052739e7c03fa79b3a57f0 (patch) | |
tree | 66714c4769ba5e81311f33a6ded544b5e9a02c6c /drivers/scsi/isci/request.c | |
parent | 312e0c2455c18716cf640d4336dcb1e9e5053818 (diff) |
isci: combine request flags
Combine three bools into one unsigned long 'flags'. Doesn't increase the
request size due to packing. (to do: optimize the structure layout).
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/request.c')
-rw-r--r-- | drivers/scsi/isci/request.c | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 55859d5331b1..27376ba22483 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -2183,7 +2183,7 @@ static void isci_request_set_open_reject_status( | |||
2183 | enum sas_open_rej_reason open_rej_reason) | 2183 | enum sas_open_rej_reason open_rej_reason) |
2184 | { | 2184 | { |
2185 | /* Task in the target is done. */ | 2185 | /* Task in the target is done. */ |
2186 | request->complete_in_target = true; | 2186 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2187 | *response_ptr = SAS_TASK_UNDELIVERED; | 2187 | *response_ptr = SAS_TASK_UNDELIVERED; |
2188 | *status_ptr = SAS_OPEN_REJECT; | 2188 | *status_ptr = SAS_OPEN_REJECT; |
2189 | *complete_to_host_ptr = isci_perform_normal_io_completion; | 2189 | *complete_to_host_ptr = isci_perform_normal_io_completion; |
@@ -2248,7 +2248,7 @@ static void isci_request_handle_controller_specific_errors( | |||
2248 | else | 2248 | else |
2249 | *status_ptr = SAS_ABORTED_TASK; | 2249 | *status_ptr = SAS_ABORTED_TASK; |
2250 | 2250 | ||
2251 | request->complete_in_target = true; | 2251 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2252 | 2252 | ||
2253 | *complete_to_host_ptr = | 2253 | *complete_to_host_ptr = |
2254 | isci_perform_normal_io_completion; | 2254 | isci_perform_normal_io_completion; |
@@ -2261,7 +2261,7 @@ static void isci_request_handle_controller_specific_errors( | |||
2261 | else | 2261 | else |
2262 | *status_ptr = SAM_STAT_TASK_ABORTED; | 2262 | *status_ptr = SAM_STAT_TASK_ABORTED; |
2263 | 2263 | ||
2264 | request->complete_in_target = false; | 2264 | clear_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2265 | 2265 | ||
2266 | *complete_to_host_ptr = | 2266 | *complete_to_host_ptr = |
2267 | isci_perform_error_io_completion; | 2267 | isci_perform_error_io_completion; |
@@ -2292,7 +2292,7 @@ static void isci_request_handle_controller_specific_errors( | |||
2292 | else | 2292 | else |
2293 | *status_ptr = SAS_ABORTED_TASK; | 2293 | *status_ptr = SAS_ABORTED_TASK; |
2294 | 2294 | ||
2295 | request->complete_in_target = true; | 2295 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2296 | 2296 | ||
2297 | *complete_to_host_ptr = isci_perform_normal_io_completion; | 2297 | *complete_to_host_ptr = isci_perform_normal_io_completion; |
2298 | break; | 2298 | break; |
@@ -2397,11 +2397,11 @@ static void isci_request_handle_controller_specific_errors( | |||
2397 | *status_ptr = SAM_STAT_TASK_ABORTED; | 2397 | *status_ptr = SAM_STAT_TASK_ABORTED; |
2398 | 2398 | ||
2399 | if (task->task_proto == SAS_PROTOCOL_SMP) { | 2399 | if (task->task_proto == SAS_PROTOCOL_SMP) { |
2400 | request->complete_in_target = true; | 2400 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2401 | 2401 | ||
2402 | *complete_to_host_ptr = isci_perform_normal_io_completion; | 2402 | *complete_to_host_ptr = isci_perform_normal_io_completion; |
2403 | } else { | 2403 | } else { |
2404 | request->complete_in_target = false; | 2404 | clear_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2405 | 2405 | ||
2406 | *complete_to_host_ptr = isci_perform_error_io_completion; | 2406 | *complete_to_host_ptr = isci_perform_error_io_completion; |
2407 | } | 2407 | } |
@@ -2552,7 +2552,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2552 | * | 2552 | * |
2553 | * The target is still there (since the TMF was successful). | 2553 | * The target is still there (since the TMF was successful). |
2554 | */ | 2554 | */ |
2555 | request->complete_in_target = true; | 2555 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2556 | response = SAS_TASK_COMPLETE; | 2556 | response = SAS_TASK_COMPLETE; |
2557 | 2557 | ||
2558 | /* See if the device has been/is being stopped. Note | 2558 | /* See if the device has been/is being stopped. Note |
@@ -2579,7 +2579,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2579 | * Aborting also means an external thread is explicitly managing | 2579 | * Aborting also means an external thread is explicitly managing |
2580 | * this request, so that we do not complete it up the stack. | 2580 | * this request, so that we do not complete it up the stack. |
2581 | */ | 2581 | */ |
2582 | request->complete_in_target = true; | 2582 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2583 | response = SAS_TASK_UNDELIVERED; | 2583 | response = SAS_TASK_UNDELIVERED; |
2584 | 2584 | ||
2585 | if (!idev) | 2585 | if (!idev) |
@@ -2605,7 +2605,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2605 | * the device (reset, tear down, etc.), and the I/O needs | 2605 | * the device (reset, tear down, etc.), and the I/O needs |
2606 | * to be completed up the stack. | 2606 | * to be completed up the stack. |
2607 | */ | 2607 | */ |
2608 | request->complete_in_target = true; | 2608 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2609 | response = SAS_TASK_UNDELIVERED; | 2609 | response = SAS_TASK_UNDELIVERED; |
2610 | 2610 | ||
2611 | /* See if the device has been/is being stopped. Note | 2611 | /* See if the device has been/is being stopped. Note |
@@ -2675,7 +2675,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2675 | /* use the task status set in the task struct by the | 2675 | /* use the task status set in the task struct by the |
2676 | * isci_request_process_response_iu call. | 2676 | * isci_request_process_response_iu call. |
2677 | */ | 2677 | */ |
2678 | request->complete_in_target = true; | 2678 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2679 | response = task->task_status.resp; | 2679 | response = task->task_status.resp; |
2680 | status = task->task_status.stat; | 2680 | status = task->task_status.stat; |
2681 | break; | 2681 | break; |
@@ -2685,7 +2685,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2685 | 2685 | ||
2686 | response = SAS_TASK_COMPLETE; | 2686 | response = SAS_TASK_COMPLETE; |
2687 | status = SAM_STAT_GOOD; | 2687 | status = SAM_STAT_GOOD; |
2688 | request->complete_in_target = true; | 2688 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2689 | 2689 | ||
2690 | if (task->task_proto == SAS_PROTOCOL_SMP) { | 2690 | if (task->task_proto == SAS_PROTOCOL_SMP) { |
2691 | void *rsp = &request->sci.smp.rsp; | 2691 | void *rsp = &request->sci.smp.rsp; |
@@ -2737,7 +2737,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2737 | /* The request was terminated explicitly. No handling | 2737 | /* The request was terminated explicitly. No handling |
2738 | * is needed in the SCSI error handler path. | 2738 | * is needed in the SCSI error handler path. |
2739 | */ | 2739 | */ |
2740 | request->complete_in_target = true; | 2740 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2741 | response = SAS_TASK_UNDELIVERED; | 2741 | response = SAS_TASK_UNDELIVERED; |
2742 | 2742 | ||
2743 | /* See if the device has been/is being stopped. Note | 2743 | /* See if the device has been/is being stopped. Note |
@@ -2777,7 +2777,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2777 | status = SAM_STAT_TASK_ABORTED; | 2777 | status = SAM_STAT_TASK_ABORTED; |
2778 | 2778 | ||
2779 | complete_to_host = isci_perform_error_io_completion; | 2779 | complete_to_host = isci_perform_error_io_completion; |
2780 | request->complete_in_target = false; | 2780 | clear_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2781 | break; | 2781 | break; |
2782 | 2782 | ||
2783 | case SCI_FAILURE_RETRY_REQUIRED: | 2783 | case SCI_FAILURE_RETRY_REQUIRED: |
@@ -2790,7 +2790,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2790 | status = SAS_ABORTED_TASK; | 2790 | status = SAS_ABORTED_TASK; |
2791 | 2791 | ||
2792 | complete_to_host = isci_perform_normal_io_completion; | 2792 | complete_to_host = isci_perform_normal_io_completion; |
2793 | request->complete_in_target = true; | 2793 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2794 | break; | 2794 | break; |
2795 | 2795 | ||
2796 | 2796 | ||
@@ -2813,10 +2813,10 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2813 | status = SAS_ABORTED_TASK; | 2813 | status = SAS_ABORTED_TASK; |
2814 | 2814 | ||
2815 | if (SAS_PROTOCOL_SMP == task->task_proto) { | 2815 | if (SAS_PROTOCOL_SMP == task->task_proto) { |
2816 | request->complete_in_target = true; | 2816 | set_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2817 | complete_to_host = isci_perform_normal_io_completion; | 2817 | complete_to_host = isci_perform_normal_io_completion; |
2818 | } else { | 2818 | } else { |
2819 | request->complete_in_target = false; | 2819 | clear_bit(IREQ_COMPLETE_IN_TARGET, &request->flags); |
2820 | complete_to_host = isci_perform_error_io_completion; | 2820 | complete_to_host = isci_perform_error_io_completion; |
2821 | } | 2821 | } |
2822 | break; | 2822 | break; |
@@ -2870,7 +2870,7 @@ static void isci_request_io_request_complete(struct isci_host *isci_host, | |||
2870 | * terminated again, and to cause any calls into abort | 2870 | * terminated again, and to cause any calls into abort |
2871 | * task to recognize the already completed case. | 2871 | * task to recognize the already completed case. |
2872 | */ | 2872 | */ |
2873 | request->terminated = true; | 2873 | set_bit(IREQ_TERMINATED, &request->flags); |
2874 | } | 2874 | } |
2875 | 2875 | ||
2876 | static void scic_sds_request_started_state_enter(struct sci_base_state_machine *sm) | 2876 | static void scic_sds_request_started_state_enter(struct sci_base_state_machine *sm) |
@@ -2919,7 +2919,7 @@ static void scic_sds_request_completed_state_enter(struct sci_base_state_machine | |||
2919 | struct isci_request *ireq = sci_req_to_ireq(sci_req); | 2919 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
2920 | 2920 | ||
2921 | /* Tell the SCI_USER that the IO request is complete */ | 2921 | /* Tell the SCI_USER that the IO request is complete */ |
2922 | if (sci_req->is_task_management_request == false) | 2922 | if (!test_bit(IREQ_TMF, &ireq->flags)) |
2923 | isci_request_io_request_complete(ihost, ireq, | 2923 | isci_request_io_request_complete(ihost, ireq, |
2924 | sci_req->sci_status); | 2924 | sci_req->sci_status); |
2925 | else | 2925 | else |
@@ -3032,8 +3032,6 @@ scic_sds_general_request_construct(struct scic_sds_controller *scic, | |||
3032 | sci_req->scu_status = 0; | 3032 | sci_req->scu_status = 0; |
3033 | sci_req->post_context = 0xFFFFFFFF; | 3033 | sci_req->post_context = 0xFFFFFFFF; |
3034 | sci_req->tc = &scic->task_context_table[ISCI_TAG_TCI(io_tag)]; | 3034 | sci_req->tc = &scic->task_context_table[ISCI_TAG_TCI(io_tag)]; |
3035 | |||
3036 | sci_req->is_task_management_request = false; | ||
3037 | WARN_ONCE(io_tag == SCI_CONTROLLER_INVALID_IO_TAG, "straggling invalid tag usage\n"); | 3035 | WARN_ONCE(io_tag == SCI_CONTROLLER_INVALID_IO_TAG, "straggling invalid tag usage\n"); |
3038 | } | 3036 | } |
3039 | 3037 | ||
@@ -3077,7 +3075,7 @@ enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | |||
3077 | 3075 | ||
3078 | if (dev->dev_type == SAS_END_DEV || | 3076 | if (dev->dev_type == SAS_END_DEV || |
3079 | dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | 3077 | dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { |
3080 | sci_req->is_task_management_request = true; | 3078 | set_bit(IREQ_TMF, &sci_req_to_ireq(sci_req)->flags); |
3081 | memset(sci_req->tc, 0, sizeof(struct scu_task_context)); | 3079 | memset(sci_req->tc, 0, sizeof(struct scu_task_context)); |
3082 | } else | 3080 | } else |
3083 | status = SCI_FAILURE_UNSUPPORTED_PROTOCOL; | 3081 | status = SCI_FAILURE_UNSUPPORTED_PROTOCOL; |
@@ -3379,12 +3377,8 @@ static struct isci_request *isci_request_alloc_core(struct isci_host *ihost, | |||
3379 | ireq->request_daddr = handle; | 3377 | ireq->request_daddr = handle; |
3380 | ireq->isci_host = ihost; | 3378 | ireq->isci_host = ihost; |
3381 | ireq->io_request_completion = NULL; | 3379 | ireq->io_request_completion = NULL; |
3382 | ireq->terminated = false; | 3380 | ireq->flags = 0; |
3383 | |||
3384 | ireq->num_sg_entries = 0; | 3381 | ireq->num_sg_entries = 0; |
3385 | |||
3386 | ireq->complete_in_target = false; | ||
3387 | |||
3388 | INIT_LIST_HEAD(&ireq->completed_node); | 3382 | INIT_LIST_HEAD(&ireq->completed_node); |
3389 | INIT_LIST_HEAD(&ireq->dev_node); | 3383 | INIT_LIST_HEAD(&ireq->dev_node); |
3390 | 3384 | ||
@@ -3496,7 +3490,7 @@ int isci_request_execute(struct isci_host *ihost, struct isci_remote_device *ide | |||
3496 | * hardware, so clear the request handle | 3490 | * hardware, so clear the request handle |
3497 | * here so no terminations will be done. | 3491 | * here so no terminations will be done. |
3498 | */ | 3492 | */ |
3499 | ireq->terminated = true; | 3493 | set_bit(IREQ_TERMINATED, &ireq->flags); |
3500 | isci_request_change_state(ireq, completed); | 3494 | isci_request_change_state(ireq, completed); |
3501 | } | 3495 | } |
3502 | spin_unlock_irqrestore(&ihost->scic_lock, flags); | 3496 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |