diff options
author | Jörn Engel <joern@logfs.org> | 2011-11-23 20:05:12 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-12-14 06:27:55 -0500 |
commit | feae85644f1460b3373ef5141183ee43e6191b58 (patch) | |
tree | e7f8dc735f0c1ca4d5cb4b6ede6f0a956a0708a1 /drivers | |
parent | c165f69c2ccbbb4ecf16c5d29d65922286bf62ff (diff) |
target: simplify target_check_cdb_and_preempt
- rename to target_check_cdb_and_preempt
- use non-safe list_for_each_entry
- move common check into callee (simplifying callers)
Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/target/target_core_tmr.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 22cefeb544bd..dcb0618c9388 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -100,15 +100,15 @@ static void core_tmr_handle_tas_abort( | |||
100 | transport_cmd_finish_abort(cmd, 0); | 100 | transport_cmd_finish_abort(cmd, 0); |
101 | } | 101 | } |
102 | 102 | ||
103 | static int core_scsi3_check_cdb_abort_and_preempt( | 103 | static int target_check_cdb_and_preempt(struct list_head *list, |
104 | struct list_head *preempt_and_abort_list, | 104 | struct se_cmd *cmd) |
105 | struct se_cmd *cmd) | ||
106 | { | 105 | { |
107 | struct t10_pr_registration *pr_reg, *pr_reg_tmp; | 106 | struct t10_pr_registration *reg; |
108 | 107 | ||
109 | list_for_each_entry_safe(pr_reg, pr_reg_tmp, preempt_and_abort_list, | 108 | if (!list) |
110 | pr_reg_abort_list) { | 109 | return 0; |
111 | if (pr_reg->pr_res_key == cmd->pr_res_key) | 110 | list_for_each_entry(reg, list, pr_reg_abort_list) { |
111 | if (reg->pr_res_key == cmd->pr_res_key) | ||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
@@ -146,9 +146,7 @@ static void core_tmr_drain_tmr_list( | |||
146 | * parameter (eg: for PROUT PREEMPT_AND_ABORT service action | 146 | * parameter (eg: for PROUT PREEMPT_AND_ABORT service action |
147 | * skip non regisration key matching TMRs. | 147 | * skip non regisration key matching TMRs. |
148 | */ | 148 | */ |
149 | if (preempt_and_abort_list && | 149 | if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) |
150 | (core_scsi3_check_cdb_abort_and_preempt( | ||
151 | preempt_and_abort_list, cmd) != 0)) | ||
152 | continue; | 150 | continue; |
153 | 151 | ||
154 | spin_lock(&cmd->t_state_lock); | 152 | spin_lock(&cmd->t_state_lock); |
@@ -225,9 +223,7 @@ static void core_tmr_drain_task_list( | |||
225 | * For PREEMPT_AND_ABORT usage, only process commands | 223 | * For PREEMPT_AND_ABORT usage, only process commands |
226 | * with a matching reservation key. | 224 | * with a matching reservation key. |
227 | */ | 225 | */ |
228 | if (preempt_and_abort_list && | 226 | if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) |
229 | (core_scsi3_check_cdb_abort_and_preempt( | ||
230 | preempt_and_abort_list, cmd) != 0)) | ||
231 | continue; | 227 | continue; |
232 | /* | 228 | /* |
233 | * Not aborting PROUT PREEMPT_AND_ABORT CDB.. | 229 | * Not aborting PROUT PREEMPT_AND_ABORT CDB.. |
@@ -335,9 +331,7 @@ static void core_tmr_drain_cmd_list( | |||
335 | * For PREEMPT_AND_ABORT usage, only process commands | 331 | * For PREEMPT_AND_ABORT usage, only process commands |
336 | * with a matching reservation key. | 332 | * with a matching reservation key. |
337 | */ | 333 | */ |
338 | if (preempt_and_abort_list && | 334 | if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd)) |
339 | (core_scsi3_check_cdb_abort_and_preempt( | ||
340 | preempt_and_abort_list, cmd) != 0)) | ||
341 | continue; | 335 | continue; |
342 | /* | 336 | /* |
343 | * Not aborting PROUT PREEMPT_AND_ABORT CDB.. | 337 | * Not aborting PROUT PREEMPT_AND_ABORT CDB.. |