Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fdeab852 authored by Nicholas Bellinger's avatar Nicholas Bellinger
Browse files

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: default avatarMartin Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 5132d1e6
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -1980,10 +1980,12 @@ 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;

	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) {
@@ -1991,6 +1993,10 @@ static bool target_check_read_strip(struct se_cmd *cmd)
				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)