iscsi: let task_pool use spdk_mempool related functions

Change-Id: I054b0f20fa502f30ae3802f95ef108fc92132ff5
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/390558
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ziye Yang 2017-12-06 12:41:52 +08:00 committed by Jim Harris
parent 7e4a7b62e1
commit 8acb3630d0
3 changed files with 10 additions and 15 deletions

View File

@ -286,7 +286,7 @@ struct spdk_iscsi_globals {
struct rte_mempool *pdu_immediate_data_pool;
struct rte_mempool *pdu_data_out_pool;
struct rte_mempool *session_pool;
struct rte_mempool *task_pool;
struct spdk_mempool *task_pool;
struct spdk_iscsi_sess **session;
};

View File

@ -390,12 +390,10 @@ spdk_iscsi_initialize_task_pool(void)
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
/* create scsi_task pool */
iscsi->task_pool = rte_mempool_create("SCSI_TASK_Pool",
DEFAULT_TASK_POOL_SIZE,
sizeof(struct spdk_iscsi_task),
128, 0,
NULL, NULL, NULL, NULL,
SOCKET_ID_ANY, 0);
iscsi->task_pool = spdk_mempool_create("SCSI_TASK_Pool",
DEFAULT_TASK_POOL_SIZE,
sizeof(struct spdk_iscsi_task),
128, SOCKET_ID_ANY);
if (!iscsi->task_pool) {
SPDK_ERRLOG("create task pool failed\n");
return -1;
@ -483,7 +481,7 @@ spdk_iscsi_free_pools(void)
rte_mempool_free(iscsi->session_pool);
rte_mempool_free(iscsi->pdu_immediate_data_pool);
rte_mempool_free(iscsi->pdu_data_out_pool);
rte_mempool_free(iscsi->task_pool);
spdk_mempool_free(iscsi->task_pool);
}
void spdk_put_pdu(struct spdk_iscsi_pdu *pdu)

View File

@ -32,9 +32,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <rte_config.h>
#include <rte_mempool.h>
#include "spdk/env.h"
#include "spdk/log.h"
#include "iscsi/conn.h"
#include "iscsi/task.h"
@ -47,7 +45,7 @@ spdk_iscsi_task_free(struct spdk_scsi_task *scsi_task)
spdk_iscsi_task_disassociate_pdu(task);
assert(task->conn->pending_task_cnt > 0);
task->conn->pending_task_cnt--;
rte_mempool_put(g_spdk_iscsi.task_pool, (void *)task);
spdk_mempool_put(g_spdk_iscsi.task_pool, (void *)task);
}
struct spdk_iscsi_task *
@ -55,10 +53,9 @@ spdk_iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent
spdk_scsi_task_cpl cpl_fn)
{
struct spdk_iscsi_task *task;
int rc;
rc = rte_mempool_get(g_spdk_iscsi.task_pool, (void **)&task);
if ((rc < 0) || !task) {
task = spdk_mempool_get(g_spdk_iscsi.task_pool);
if (!task) {
SPDK_ERRLOG("Unable to get task\n");
abort();
}