iscsi: Increase the size of write buffers to store DIF
Increase the size of write (data out) buffers and immediate data buffers in the iSCSI library to store DIF. Increase is the amount necessary to store 16 byte metadata block to the block formatted iwth 512 + 16. 512 + 16 is the current maximum ratio of metadata per block. Use the macro SPDK_BDEV_BUF_SIZE_WITH_MD defined in include/spdk/bdev.h for this purpose. Besides, change the name of a helper function from spdk_get_immediate_data_buffer_size() to spdk_get_max_immediate_data_size() to differentiate the maximum data size and the buffer size, and then to use the macro. Change-Id: I626f8045ff706e1a6d79fa298261769bc96b7d8b Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447011 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
a18c0acd8c
commit
c24f506993
@ -374,7 +374,7 @@ spdk_iscsi_check_data_segment_length(struct spdk_iscsi_conn *conn,
|
||||
pdu->bhs.opcode == ISCSI_OP_NOPOUT) {
|
||||
max_segment_len = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH;
|
||||
} else {
|
||||
max_segment_len = spdk_get_immediate_data_buffer_size();
|
||||
max_segment_len = spdk_get_max_immediate_data_size();
|
||||
}
|
||||
if (data_len <= max_segment_len) {
|
||||
return true;
|
||||
@ -466,12 +466,12 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
|
||||
/* copy the actual data into local buffer */
|
||||
if (pdu->data_valid_bytes < data_len) {
|
||||
if (pdu->data_buf == NULL) {
|
||||
if (data_len <= spdk_get_immediate_data_buffer_size()) {
|
||||
if (data_len <= spdk_get_max_immediate_data_size()) {
|
||||
pool = g_spdk_iscsi.pdu_immediate_data_pool;
|
||||
pdu->data_buf_len = spdk_get_immediate_data_buffer_size();
|
||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(spdk_get_max_immediate_data_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;
|
||||
pdu->data_buf_len = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||
} else {
|
||||
SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n",
|
||||
data_len, SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
|
||||
|
@ -441,7 +441,7 @@ void spdk_iscsi_op_abort_task_set(struct spdk_iscsi_task *task,
|
||||
uint8_t function);
|
||||
|
||||
static inline int
|
||||
spdk_get_immediate_data_buffer_size(void)
|
||||
spdk_get_max_immediate_data_size(void)
|
||||
{
|
||||
/*
|
||||
* Specify enough extra space in addition to FirstBurstLength to
|
||||
|
@ -138,16 +138,16 @@ spdk_mobj_ctor(struct spdk_mempool *mp, __attribute__((unused)) void *arg,
|
||||
}
|
||||
|
||||
#define NUM_PDU_PER_CONNECTION(iscsi) (2 * (iscsi->MaxQueueDepth + MAX_LARGE_DATAIN_PER_CONNECTION + 8))
|
||||
#define PDU_POOL_SIZE(iscsi) (iscsi->MaxConnections * NUM_PDU_PER_CONNECTION(iscsi))
|
||||
#define PDU_POOL_SIZE(iscsi) (iscsi->MaxConnections * NUM_PDU_PER_CONNECTION(iscsi))
|
||||
#define IMMEDIATE_DATA_POOL_SIZE(iscsi) (iscsi->MaxConnections * 128)
|
||||
#define DATA_OUT_POOL_SIZE(iscsi) (iscsi->MaxConnections * MAX_DATA_OUT_PER_CONNECTION)
|
||||
|
||||
static int spdk_iscsi_initialize_pdu_pool(void)
|
||||
{
|
||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||
int imm_mobj_size = spdk_get_immediate_data_buffer_size() +
|
||||
int imm_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(spdk_get_max_immediate_data_size()) +
|
||||
sizeof(struct spdk_mobj) + ISCSI_DATA_BUFFER_ALIGNMENT;
|
||||
int dout_mobj_size = SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH +
|
||||
int dout_mobj_size = SPDK_BDEV_BUF_SIZE_WITH_MD(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH) +
|
||||
sizeof(struct spdk_mobj) + ISCSI_DATA_BUFFER_ALIGNMENT;
|
||||
|
||||
/* create PDU pool */
|
||||
|
Loading…
x
Reference in New Issue
Block a user