summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-02-08 12:39:06 -0800
committerNicholas Bellinger <nab@linux-iscsi.org>2015-04-07 23:26:25 -0700
commitaa58b53168e12342aa0561c12bf5d6729487c63e (patch)
tree6f151ca0067ba6eae5f1c93d984201b655369af6 /drivers/target
parent9ef5466ee2f0599caf8d84203d36e581c6fc7035 (diff)
downloadlinux-aa58b53168e12342aa0561c12bf5d6729487c63e.tar.bz2
target: Move cmd->prot_op check into target_write_prot_action
This patch moves the existing target_execute_cmd() check for cmd->prot_op into it's own function, so it's easier to add future support for WRITE STRIP. (Use better target_write_prot_action name - Sagi) Reviewed-by: Martin Petersen <martin.petersen@oracle.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_transport.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index aef989e165ed..2a0c36bf3226 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1738,6 +1738,25 @@ void __target_execute_cmd(struct se_cmd *cmd)
}
}
+static int target_write_prot_action(struct se_cmd *cmd)
+{
+ /*
+ * Perform WRITE_INSERT of PI using software emulation when backend
+ * device has PI enabled, if the transport has not already generated
+ * PI using hardware WRITE_INSERT offload.
+ */
+ switch (cmd->prot_op) {
+ case TARGET_PROT_DOUT_INSERT:
+ if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DOUT_INSERT))
+ sbc_dif_generate(cmd);
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
static bool target_handle_task_attr(struct se_cmd *cmd)
{
struct se_device *dev = cmd->se_dev;
@@ -1817,15 +1836,9 @@ void target_execute_cmd(struct se_cmd *cmd)
cmd->t_state = TRANSPORT_PROCESSING;
cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT;
spin_unlock_irq(&cmd->t_state_lock);
- /*
- * Perform WRITE_INSERT of PI using software emulation when backend
- * device has PI enabled, if the transport has not already generated
- * PI using hardware WRITE_INSERT offload.
- */
- if (cmd->prot_op == TARGET_PROT_DOUT_INSERT) {
- if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DOUT_INSERT))
- sbc_dif_generate(cmd);
- }
+
+ if (target_write_prot_action(cmd))
+ return;
if (target_handle_task_attr(cmd)) {
spin_lock_irq(&cmd->t_state_lock);