Re: [PATCH 08/36] target: Refactor core_tmr_abort_task

Thinh Nguyen
2022-07-09T00:02:58Z

On 7/7/2022, Dmitry Bogdanov wrote:
> On Wed, Jul 06, 2022 at 04:35:14PM -0700, Thinh Nguyen wrote:
>> Minor refactoring of core_tmr_abort_task to avoid duplicate code. No
>> functional change here.
> Regardless that previous patch on that place is incorrect,
> this patch also breaks the statistic counters.
> dev->aborts_no_task counter is incremented on the end of the function,
> and should not be incremented for the case when command to be aborted is
> found.

Ah... I missed that. Thanks for the catch.

Thinh

>> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
>> ---
>> drivers/target/target_core_tmr.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
>> index 718d985e4860..3e73f60319d5 100644
>> --- a/drivers/target/target_core_tmr.c
>> +++ b/drivers/target/target_core_tmr.c
>> @@ -158,15 +158,13 @@ void core_tmr_abort_task(
>> list_del_init(&se_cmd->state_list);
>> target_put_cmd_and_wait(se_cmd);
>>
>> - pr_err("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %llu\n",
>> - ref_tag);
>> - tmr->response = TMR_FUNCTION_COMPLETE;
>> atomic_long_inc(&dev->aborts_complete);
>> - return;
>> + goto exit;
>> }
>> spin_unlock_irqrestore(&dev->queues[i].lock, flags);
>> }
>>
>> +exit:
>> printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for ref_tag: %lld\n",
>> tmr->ref_task_tag);
>> tmr->response = TMR_FUNCTION_COMPLETE;