iscsi: Hold size of buffer to store PDU data segment in struct spdk_iscsi_pdu
Upcoming patches will store larger data in the data buffer than iSCSI Initiator transfers, and size of metadata is not known until asking to SCSI layer. This addition will be used to avoid overflow in them. Change-Id: I43e15d0cfbfddcf01342325b134d90e3d7dae038 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446378 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
af85c0ff68
commit
e17851314e
@ -468,8 +468,10 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
||||
if (pdu->data_buf == NULL) {
|
||||
if (data_len <= spdk_get_immediate_data_buffer_size()) {
|
||||
pool = g_spdk_iscsi.pdu_immediate_data_pool;
|
||||
pdu->data_buf_len = spdk_get_immediate_data_buffer_size();
|
||||
} else if (data_len <= SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) {
|
||||
pool = g_spdk_iscsi.pdu_data_out_pool;
|
||||
pdu->data_buf_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
|
||||
} else {
|
||||
SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n",
|
||||
data_len, SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||
@ -2595,6 +2597,7 @@ spdk_iscsi_send_datain(struct spdk_iscsi_conn *conn,
|
||||
rsp_pdu = spdk_get_pdu();
|
||||
rsph = (struct iscsi_bhs_data_in *)&rsp_pdu->bhs;
|
||||
rsp_pdu->data = task->scsi.iovs[0].iov_base + offset;
|
||||
rsp_pdu->data_buf_len = task->scsi.iovs[0].iov_len - offset;
|
||||
rsp_pdu->data_from_mempool = true;
|
||||
|
||||
task_tag = task->tag;
|
||||
|
@ -172,6 +172,7 @@ struct spdk_iscsi_pdu {
|
||||
struct spdk_iscsi_task *task; /* data tied to a task buffer */
|
||||
uint32_t cmd_sn;
|
||||
uint32_t writev_offset;
|
||||
uint32_t data_buf_len;
|
||||
TAILQ_ENTRY(spdk_iscsi_pdu) tailq;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user