提交 acb2bde3 编写于 作者: S Sagi Grimberg 提交者: Nicholas Bellinger

Target/transport: Allocate protection sg if needed

In case protection information is involved, allocate
protection SG-list for transport.
Signed-off-by: NSagi Grimberg <sagig@mellanox.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 1e3ab99d
...@@ -2039,6 +2039,10 @@ static inline void transport_free_pages(struct se_cmd *cmd) ...@@ -2039,6 +2039,10 @@ static inline void transport_free_pages(struct se_cmd *cmd)
transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents); transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents);
cmd->t_bidi_data_sg = NULL; cmd->t_bidi_data_sg = NULL;
cmd->t_bidi_data_nents = 0; cmd->t_bidi_data_nents = 0;
transport_free_sgl(cmd->t_prot_sg, cmd->t_prot_nents);
cmd->t_prot_sg = NULL;
cmd->t_prot_nents = 0;
} }
/** /**
...@@ -2202,6 +2206,14 @@ transport_generic_new_cmd(struct se_cmd *cmd) ...@@ -2202,6 +2206,14 @@ transport_generic_new_cmd(struct se_cmd *cmd)
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
} }
if (cmd->prot_type != TARGET_PROT_NORMAL) {
ret = target_alloc_sgl(&cmd->t_prot_sg,
&cmd->t_prot_nents,
cmd->prot_length, true);
if (ret < 0)
return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
}
ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents, ret = target_alloc_sgl(&cmd->t_data_sg, &cmd->t_data_nents,
cmd->data_length, zero_flag); cmd->data_length, zero_flag);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册