Commit abc1fd4f authored by Joern Engel's avatar Joern Engel Committed by Nicholas Bellinger

target: Minor cleanups to core_tmr_drain_tmr_list

This patch adds a handful minor cleanups to core_tmr_drain_tmr_list() that
remove an unnecessary NULL check, use list_for_each_entry_safe() instead of
list_entry(), and makes the drain_tmr_list walk use *tmr_p instead of
directly referencing the passed *tmr function parameter.
Signed-off-by: default avatarJoern Engel <joern@logfs.org>
Cc: Joern Engel <joern@logfs.org>
Reviewed-by: default avatarRoland Dreier <roland@purestorage.com>
Cc: Roland Dreier <roland@purestorage.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 6eb40b2a
...@@ -118,7 +118,7 @@ static void core_tmr_drain_tmr_list( ...@@ -118,7 +118,7 @@ static void core_tmr_drain_tmr_list(
/* /*
* Allow the received TMR to return with FUNCTION_COMPLETE. * Allow the received TMR to return with FUNCTION_COMPLETE.
*/ */
if (tmr && (tmr_p == tmr)) if (tmr_p == tmr)
continue; continue;
cmd = tmr_p->task_cmd; cmd = tmr_p->task_cmd;
...@@ -151,15 +151,14 @@ static void core_tmr_drain_tmr_list( ...@@ -151,15 +151,14 @@ static void core_tmr_drain_tmr_list(
} }
spin_unlock_irqrestore(&dev->se_tmr_lock, flags); spin_unlock_irqrestore(&dev->se_tmr_lock, flags);
while (!list_empty(&drain_tmr_list)) { list_for_each_entry_safe(tmr_p, tmr_pp, &drain_tmr_list, tmr_list) {
tmr = list_entry(drain_tmr_list.next, struct se_tmr_req, tmr_list); list_del(&tmr_p->tmr_list);
list_del(&tmr->tmr_list); cmd = tmr_p->task_cmd;
cmd = tmr->task_cmd;
pr_debug("LUN_RESET: %s releasing TMR %p Function: 0x%02x," pr_debug("LUN_RESET: %s releasing TMR %p Function: 0x%02x,"
" Response: 0x%02x, t_state: %d\n", " Response: 0x%02x, t_state: %d\n",
(preempt_and_abort_list) ? "Preempt" : "", tmr, (preempt_and_abort_list) ? "Preempt" : "", tmr_p,
tmr->function, tmr->response, cmd->t_state); tmr_p->function, tmr_p->response, cmd->t_state);
transport_cmd_finish_abort(cmd, 1); transport_cmd_finish_abort(cmd, 1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment