summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-02-08 02:53:25 -0800
committerNicholas Bellinger <nab@linux-iscsi.org>2015-04-07 23:26:56 -0700
commitfdeab852983249fd1b8859f8bf54a5bfd8581c90 (patch)
tree17c5d93be41dc552e0803c38f58b30df515b6978 /drivers/target
parent5132d1e655dc4befcc075ef32a261eb9733bb04c (diff)
downloadop-kernel-dev-fdeab852983249fd1b8859f8bf54a5bfd8581c90.zip
op-kernel-dev-fdeab852983249fd1b8859f8bf54a5bfd8581c90.tar.gz
target: Move cmd->prot_op check into target_read_prot_action
This patch moves the existing target_complete_ok_work() check for cmd->prot_op into it's own function, so it's easier to add future support for READ INSERT. 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.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 0fe58bf..bfdd623 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1980,16 +1980,22 @@ static void transport_handle_queue_full(
schedule_work(&cmd->se_dev->qf_work_queue);
}
-static bool target_check_read_strip(struct se_cmd *cmd)
+static bool target_read_prot_action(struct se_cmd *cmd)
{
sense_reason_t rc;
- if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DIN_STRIP)) {
- rc = sbc_dif_read_strip(cmd);
- if (rc) {
- cmd->pi_err = rc;
- return true;
+ switch (cmd->prot_op) {
+ case TARGET_PROT_DIN_STRIP:
+ if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DIN_STRIP)) {
+ rc = sbc_dif_read_strip(cmd);
+ if (rc) {
+ cmd->pi_err = rc;
+ return true;
+ }
}
+ break;
+ default:
+ break;
}
return false;
@@ -2064,8 +2070,7 @@ static void target_complete_ok_work(struct work_struct *work)
* backend had PI enabled, if the transport will not be
* performing hardware READ_STRIP offload.
*/
- if (cmd->prot_op == TARGET_PROT_DIN_STRIP &&
- target_check_read_strip(cmd)) {
+ if (target_read_prot_action(cmd)) {
ret = transport_send_check_condition_and_sense(cmd,
cmd->pi_err, 0);
if (ret == -EAGAIN || ret == -ENOMEM)
OpenPOWER on IntegriCloud