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

Dmitry Bogdanov
2022-07-07T13:40:35Z

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.

>
> 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;