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:
parent
7e4a7b62e1
commit
8acb3630d0
@ -286,7 +286,7 @@ struct spdk_iscsi_globals {
|
|||||||
struct rte_mempool *pdu_immediate_data_pool;
|
struct rte_mempool *pdu_immediate_data_pool;
|
||||||
struct rte_mempool *pdu_data_out_pool;
|
struct rte_mempool *pdu_data_out_pool;
|
||||||
struct rte_mempool *session_pool;
|
struct rte_mempool *session_pool;
|
||||||
struct rte_mempool *task_pool;
|
struct spdk_mempool *task_pool;
|
||||||
|
|
||||||
struct spdk_iscsi_sess **session;
|
struct spdk_iscsi_sess **session;
|
||||||
};
|
};
|
||||||
|
@ -390,12 +390,10 @@ spdk_iscsi_initialize_task_pool(void)
|
|||||||
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
struct spdk_iscsi_globals *iscsi = &g_spdk_iscsi;
|
||||||
|
|
||||||
/* create scsi_task pool */
|
/* create scsi_task pool */
|
||||||
iscsi->task_pool = rte_mempool_create("SCSI_TASK_Pool",
|
iscsi->task_pool = spdk_mempool_create("SCSI_TASK_Pool",
|
||||||
DEFAULT_TASK_POOL_SIZE,
|
DEFAULT_TASK_POOL_SIZE,
|
||||||
sizeof(struct spdk_iscsi_task),
|
sizeof(struct spdk_iscsi_task),
|
||||||
128, 0,
|
128, SOCKET_ID_ANY);
|
||||||
NULL, NULL, NULL, NULL,
|
|
||||||
SOCKET_ID_ANY, 0);
|
|
||||||
if (!iscsi->task_pool) {
|
if (!iscsi->task_pool) {
|
||||||
SPDK_ERRLOG("create task pool failed\n");
|
SPDK_ERRLOG("create task pool failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
@ -483,7 +481,7 @@ spdk_iscsi_free_pools(void)
|
|||||||
rte_mempool_free(iscsi->session_pool);
|
rte_mempool_free(iscsi->session_pool);
|
||||||
rte_mempool_free(iscsi->pdu_immediate_data_pool);
|
rte_mempool_free(iscsi->pdu_immediate_data_pool);
|
||||||
rte_mempool_free(iscsi->pdu_data_out_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)
|
void spdk_put_pdu(struct spdk_iscsi_pdu *pdu)
|
||||||
|
@ -32,9 +32,7 @@
|
|||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <rte_config.h>
|
#include "spdk/env.h"
|
||||||
#include <rte_mempool.h>
|
|
||||||
|
|
||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
#include "iscsi/conn.h"
|
#include "iscsi/conn.h"
|
||||||
#include "iscsi/task.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);
|
spdk_iscsi_task_disassociate_pdu(task);
|
||||||
assert(task->conn->pending_task_cnt > 0);
|
assert(task->conn->pending_task_cnt > 0);
|
||||||
task->conn->pending_task_cnt--;
|
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 *
|
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)
|
spdk_scsi_task_cpl cpl_fn)
|
||||||
{
|
{
|
||||||
struct spdk_iscsi_task *task;
|
struct spdk_iscsi_task *task;
|
||||||
int rc;
|
|
||||||
|
|
||||||
rc = rte_mempool_get(g_spdk_iscsi.task_pool, (void **)&task);
|
task = spdk_mempool_get(g_spdk_iscsi.task_pool);
|
||||||
if ((rc < 0) || !task) {
|
if (!task) {
|
||||||
SPDK_ERRLOG("Unable to get task\n");
|
SPDK_ERRLOG("Unable to get task\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user