diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-02-08 05:53:25 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-04-08 02:26:56 -0400 |
commit | fdeab852983249fd1b8859f8bf54a5bfd8581c90 (patch) | |
tree | 17c5d93be41dc552e0803c38f58b30df515b6978 /drivers/target | |
parent | 5132d1e655dc4befcc075ef32a261eb9733bb04c (diff) |
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.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 0fe58bfabfc2..bfdd6237a3d1 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( | |||
1980 | schedule_work(&cmd->se_dev->qf_work_queue); | 1980 | schedule_work(&cmd->se_dev->qf_work_queue); |
1981 | } | 1981 | } |
1982 | 1982 | ||
1983 | static bool target_check_read_strip(struct se_cmd *cmd) | 1983 | static bool target_read_prot_action(struct se_cmd *cmd) |
1984 | { | 1984 | { |
1985 | sense_reason_t rc; | 1985 | sense_reason_t rc; |
1986 | 1986 | ||
1987 | if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DIN_STRIP)) { | 1987 | switch (cmd->prot_op) { |
1988 | rc = sbc_dif_read_strip(cmd); | 1988 | case TARGET_PROT_DIN_STRIP: |
1989 | if (rc) { | 1989 | if (!(cmd->se_sess->sup_prot_ops & TARGET_PROT_DIN_STRIP)) { |
1990 | cmd->pi_err = rc; | 1990 | rc = sbc_dif_read_strip(cmd); |
1991 | return true; | 1991 | if (rc) { |
1992 | cmd->pi_err = rc; | ||
1993 | return true; | ||
1994 | } | ||
1992 | } | 1995 | } |
1996 | break; | ||
1997 | default: | ||
1998 | break; | ||
1993 | } | 1999 | } |
1994 | 2000 | ||
1995 | return false; | 2001 | return false; |
@@ -2064,8 +2070,7 @@ static void target_complete_ok_work(struct work_struct *work) | |||
2064 | * backend had PI enabled, if the transport will not be | 2070 | * backend had PI enabled, if the transport will not be |
2065 | * performing hardware READ_STRIP offload. | 2071 | * performing hardware READ_STRIP offload. |
2066 | */ | 2072 | */ |
2067 | if (cmd->prot_op == TARGET_PROT_DIN_STRIP && | 2073 | if (target_read_prot_action(cmd)) { |
2068 | target_check_read_strip(cmd)) { | ||
2069 | ret = transport_send_check_condition_and_sense(cmd, | 2074 | ret = transport_send_check_condition_and_sense(cmd, |
2070 | cmd->pi_err, 0); | 2075 | cmd->pi_err, 0); |
2071 | if (ret == -EAGAIN || ret == -ENOMEM) | 2076 | if (ret == -EAGAIN || ret == -ENOMEM) |