aboutsummaryrefslogtreecommitdiff
path: root/drivers/target/target_core_tmr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:59:18 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-18 15:59:18 -0800
commit4ba3069fea9f0771dad3f4906b305ab50d5a1b30 (patch)
tree3f75f2c0a320a6f38538c5e63f46ef79b0b3f1d1 /drivers/target/target_core_tmr.c
parent507a03c1cba0e32309223d23d19a1bfc0916c140 (diff)
parent895f3022523361e9b383cf48f51feb1f7d5e7e53 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (26 commits) target: Set additional sense length field in sense data target: Remove legacy device status check from transport_execute_tasks target: Remove __transport_execute_tasks() for each processing context target: Remove extra se_device->execute_task_lock access in fast path target: Drop se_device TCQ queue_depth usage from I/O path target: Fix possible NULL pointer with __transport_execute_tasks target: Remove TFO->check_release_cmd() fabric API caller tcm_fc: Convert ft_send_work to use target_submit_cmd target: Add target_submit_cmd() for process context fabric submission target: Make target_put_sess_cmd use target_release_cmd_kref target: Set response format in INQUIRY response target: tcm_mod_builder: small fixups Documentation/target: Fix tcm_mod_builder.py build breakage target: remove overagressive ____cacheline_aligned annoations tcm_loop: bump max_sectors target/configs: remove trailing newline from udev_path and alias iscsi-target: fix chap identifier simple_strtoul usage target: remove useless casts target: simplify target_check_cdb_and_preempt target: Move core_scsi3_check_cdb_abort_and_preempt ...
Diffstat (limited to 'drivers/target/target_core_tmr.c')
-rw-r--r--drivers/target/target_core_tmr.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
index 684522805a1..dcb0618c938 100644
--- a/drivers/target/target_core_tmr.c
+++ b/drivers/target/target_core_tmr.c
@@ -32,12 +32,11 @@
#include <scsi/scsi_cmnd.h>
#include <target/target_core_base.h>
-#include <target/target_core_device.h>
-#include <target/target_core_tmr.h>
-#include <target/target_core_transport.h>
-#include <target/target_core_fabric_ops.h>
+#include <target/target_core_backend.h>
+#include <target/target_core_fabric.h>
#include <target/target_core_configfs.h>
+#include "target_core_internal.h"
#include "target_core_alua.h"
#include "target_core_pr.h"
@@ -101,6 +100,21 @@ static void core_tmr_handle_tas_abort(
transport_cmd_finish_abort(cmd, 0);
}
+static int target_check_cdb_and_preempt(struct list_head *list,
+ struct se_cmd *cmd)
+{
+ struct t10_pr_registration *reg;
+
+ if (!list)
+ return 0;
+ list_for_each_entry(reg, list, pr_reg_abort_list) {
+ if (reg->pr_res_key == cmd->pr_res_key)
+ return 0;
+ }
+
+ return 1;
+}
+
static void core_tmr_drain_tmr_list(
struct se_device *dev,
struct se_tmr_req *tmr,
@@ -132,9 +146,7 @@ static void core_tmr_drain_tmr_list(
* parameter (eg: for PROUT PREEMPT_AND_ABORT service action
* skip non regisration key matching TMRs.
*/
- if (preempt_and_abort_list &&
- (core_scsi3_check_cdb_abort_and_preempt(
- preempt_and_abort_list, cmd) != 0))
+ if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd))
continue;
spin_lock(&cmd->t_state_lock);
@@ -211,9 +223,7 @@ static void core_tmr_drain_task_list(
* For PREEMPT_AND_ABORT usage, only process commands
* with a matching reservation key.
*/
- if (preempt_and_abort_list &&
- (core_scsi3_check_cdb_abort_and_preempt(
- preempt_and_abort_list, cmd) != 0))
+ if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd))
continue;
/*
* Not aborting PROUT PREEMPT_AND_ABORT CDB..
@@ -222,7 +232,7 @@ static void core_tmr_drain_task_list(
continue;
list_move_tail(&task->t_state_list, &drain_task_list);
- atomic_set(&task->task_state_active, 0);
+ task->t_state_active = false;
/*
* Remove from task execute list before processing drain_task_list
*/
@@ -321,9 +331,7 @@ static void core_tmr_drain_cmd_list(
* For PREEMPT_AND_ABORT usage, only process commands
* with a matching reservation key.
*/
- if (preempt_and_abort_list &&
- (core_scsi3_check_cdb_abort_and_preempt(
- preempt_and_abort_list, cmd) != 0))
+ if (target_check_cdb_and_preempt(preempt_and_abort_list, cmd))
continue;
/*
* Not aborting PROUT PREEMPT_AND_ABORT CDB..