Revert "iscsi: optimization for read process."

This reverses commit d79522497a.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id6b431f90df35ff77736c0059b065092b7e1e9b8
This commit is contained in:
Jim Harris 2016-09-23 11:35:54 -07:00
parent f3d90c9165
commit 5e86ed2620
3 changed files with 27 additions and 27 deletions

View File

@ -1093,14 +1093,17 @@ spdk_iscsi_conn_flush_pdus_internal(struct spdk_iscsi_conn *conn)
tailq); tailq);
} else { } else {
if (pdu->task) { if (pdu->task) {
if (pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN && if (pdu->bhs.opcode == ISCSI_OP_SCSI_DATAIN) {
pdu->task->scsi.length > SPDK_BDEV_SMALL_RBUF_MAX_SIZE) { if (pdu->task->scsi.offset > 0) {
conn->data_in_cnt--; conn->data_in_cnt--;
if (pdu->bhs.flags & ISCSI_DATAIN_STATUS) { if (pdu->bhs.flags & ISCSI_DATAIN_STATUS) {
spdk_iscsi_task_put(spdk_iscsi_task_get_primary(pdu->task)); spdk_iscsi_task_put(spdk_iscsi_task_get_primary(pdu->task));
}
} }
spdk_iscsi_conn_handle_queued_tasks(conn);
spdk_iscsi_conn_handle_queued_datain(conn);
} }
spdk_iscsi_task_put(pdu->task); spdk_iscsi_task_put(pdu->task);
} }
spdk_put_pdu(pdu); spdk_put_pdu(pdu);

View File

@ -2843,21 +2843,15 @@ static void spdk_iscsi_queue_mgmt_task(struct spdk_iscsi_conn *conn,
spdk_scsi_dev_queue_mgmt_task(conn->dev, &task->scsi); spdk_scsi_dev_queue_mgmt_task(conn->dev, &task->scsi);
} }
int spdk_iscsi_conn_handle_queued_tasks(struct spdk_iscsi_conn *conn) int spdk_iscsi_conn_handle_queued_datain(struct spdk_iscsi_conn *conn)
{ {
struct spdk_iscsi_task *task; struct spdk_iscsi_task *task;
while (!TAILQ_EMPTY(&conn->queued_datain_tasks) && while (!TAILQ_EMPTY(&conn->queued_datain_tasks) &&
conn->data_in_cnt < MAX_LARGE_DATAIN_PER_CONNECTION) { conn->data_in_cnt < MAX_EXTRA_DATAIN_PER_CONNECTION) {
task = TAILQ_FIRST(&conn->queued_datain_tasks); task = TAILQ_FIRST(&conn->queued_datain_tasks);
assert(task->current_datain_offset <= task->scsi.transfer_len); assert(task->current_datain_offset <= task->scsi.transfer_len);
if (task->current_datain_offset == 0) {
task->current_datain_offset = task->scsi.length;
conn->data_in_cnt++;
spdk_iscsi_queue_task(conn, task);
continue;
}
if (task->current_datain_offset < task->scsi.transfer_len) { if (task->current_datain_offset < task->scsi.transfer_len) {
struct spdk_iscsi_task *subtask; struct spdk_iscsi_task *subtask;
uint32_t remaining_size = 0; uint32_t remaining_size = 0;
@ -2882,22 +2876,24 @@ int spdk_iscsi_conn_handle_queued_tasks(struct spdk_iscsi_conn *conn)
static int spdk_iscsi_op_scsi_read(struct spdk_iscsi_conn *conn, static int spdk_iscsi_op_scsi_read(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_task *task) struct spdk_iscsi_task *task)
{ {
int32_t remaining_size = 0;
TAILQ_INIT(&task->scsi.subtask_list); TAILQ_INIT(&task->scsi.subtask_list);
task->scsi.dxfer_dir = SPDK_SCSI_DIR_FROM_DEV; task->scsi.dxfer_dir = SPDK_SCSI_DIR_FROM_DEV;
task->scsi.parent = NULL; task->scsi.parent = NULL;
task->scsi.offset = 0; task->scsi.offset = 0;
task->scsi.length = DMIN32(SPDK_BDEV_LARGE_RBUF_MAX_SIZE, task->scsi.transfer_len); task->scsi.length = DMIN32(SPDK_BDEV_LARGE_RBUF_MAX_SIZE, task->scsi.transfer_len);
task->scsi.rbuf = NULL; task->scsi.rbuf = NULL;
task->current_datain_offset = 0; spdk_iscsi_queue_task(conn, task);
if (task->scsi.transfer_len <= SPDK_BDEV_SMALL_RBUF_MAX_SIZE) { remaining_size = task->scsi.transfer_len - task->scsi.length;
spdk_iscsi_queue_task(conn, task); task->current_datain_offset = task->scsi.length;
return 0;
if (remaining_size > 0) {
TAILQ_INSERT_TAIL(&conn->queued_datain_tasks, task, link);
return spdk_iscsi_conn_handle_queued_datain(conn);
} }
return 0;
TAILQ_INSERT_TAIL(&conn->queued_datain_tasks, task, link);
return spdk_iscsi_conn_handle_queued_tasks(conn);
} }
static int static int

View File

@ -107,12 +107,13 @@
/* /*
* Defines maximum number of data in buffers each connection can have in * Defines maximum number of data in buffers each connection can have in
* use at any given time. So this limit does not affect I/O smaller than * use at any given time. An "extra data in buffer" means any buffer after
* SPDK_BDEV_SMALL_RBUF_MAX_SIZE. * the first for the iSCSI I/O command. So this limit does not affect I/O
* smaller than SPDK_ISCSI_MAX_SEND_DATA_SEGMENT_LENGTH.
*/ */
#define MAX_LARGE_DATAIN_PER_CONNECTION 64 #define MAX_EXTRA_DATAIN_PER_CONNECTION 64
#define NUM_PDU_PER_CONNECTION (2 * (SPDK_ISCSI_MAX_QUEUE_DEPTH + MAX_LARGE_DATAIN_PER_CONNECTION + 8)) #define NUM_PDU_PER_CONNECTION (2 * (SPDK_ISCSI_MAX_QUEUE_DEPTH + MAX_EXTRA_DATAIN_PER_CONNECTION + 8))
#define SPDK_ISCSI_MAX_BURST_LENGTH \ #define SPDK_ISCSI_MAX_BURST_LENGTH \
(SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH * MAX_DATA_OUT_PER_CONNECTION) (SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH * MAX_DATA_OUT_PER_CONNECTION)
@ -357,7 +358,7 @@ void process_task_mgmt_completion(spdk_event_t event);
/* Memory management */ /* Memory management */
void spdk_put_pdu(struct spdk_iscsi_pdu *pdu); void spdk_put_pdu(struct spdk_iscsi_pdu *pdu);
struct spdk_iscsi_pdu *spdk_get_pdu(void); struct spdk_iscsi_pdu *spdk_get_pdu(void);
int spdk_iscsi_conn_handle_queued_tasks(struct spdk_iscsi_conn *conn); int spdk_iscsi_conn_handle_queued_datain(struct spdk_iscsi_conn *conn);
static inline int static inline int
spdk_get_immediate_data_buffer_size(void) spdk_get_immediate_data_buffer_size(void)