mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 14:43:16 +00:00
nvme-tcp: split nvme_tcp_alloc_tagset
Split nvme_tcp_alloc_tagset into one helper for the admin tag_set and one for the I/O tag set. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a7f7b7116c
commit
2f7a7e5d85
@ -1687,45 +1687,49 @@ static int nvme_tcp_start_queue(struct nvme_ctrl *nctrl, int idx)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl,
|
static int nvme_tcp_alloc_admin_tag_set(struct nvme_ctrl *nctrl)
|
||||||
bool admin)
|
|
||||||
{
|
{
|
||||||
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
|
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
|
||||||
struct blk_mq_tag_set *set;
|
struct blk_mq_tag_set *set = &ctrl->admin_tag_set;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (admin) {
|
memset(set, 0, sizeof(*set));
|
||||||
set = &ctrl->admin_tag_set;
|
set->ops = &nvme_tcp_admin_mq_ops;
|
||||||
memset(set, 0, sizeof(*set));
|
set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
|
||||||
set->ops = &nvme_tcp_admin_mq_ops;
|
set->reserved_tags = NVMF_RESERVED_TAGS;
|
||||||
set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
|
set->numa_node = nctrl->numa_node;
|
||||||
set->reserved_tags = NVMF_RESERVED_TAGS;
|
set->flags = BLK_MQ_F_BLOCKING;
|
||||||
set->numa_node = nctrl->numa_node;
|
set->cmd_size = sizeof(struct nvme_tcp_request);
|
||||||
set->flags = BLK_MQ_F_BLOCKING;
|
set->driver_data = ctrl;
|
||||||
set->cmd_size = sizeof(struct nvme_tcp_request);
|
set->nr_hw_queues = 1;
|
||||||
set->driver_data = ctrl;
|
set->timeout = NVME_ADMIN_TIMEOUT;
|
||||||
set->nr_hw_queues = 1;
|
|
||||||
set->timeout = NVME_ADMIN_TIMEOUT;
|
|
||||||
} else {
|
|
||||||
set = &ctrl->tag_set;
|
|
||||||
memset(set, 0, sizeof(*set));
|
|
||||||
set->ops = &nvme_tcp_mq_ops;
|
|
||||||
set->queue_depth = nctrl->sqsize + 1;
|
|
||||||
set->reserved_tags = NVMF_RESERVED_TAGS;
|
|
||||||
set->numa_node = nctrl->numa_node;
|
|
||||||
set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING;
|
|
||||||
set->cmd_size = sizeof(struct nvme_tcp_request);
|
|
||||||
set->driver_data = ctrl;
|
|
||||||
set->nr_hw_queues = nctrl->queue_count - 1;
|
|
||||||
set->timeout = NVME_IO_TIMEOUT;
|
|
||||||
set->nr_maps = nctrl->opts->nr_poll_queues ? HCTX_MAX_TYPES : 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = blk_mq_alloc_tag_set(set);
|
ret = blk_mq_alloc_tag_set(set);
|
||||||
if (ret)
|
if (!ret)
|
||||||
return ERR_PTR(ret);
|
nctrl->admin_tagset = set;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return set;
|
static int nvme_tcp_alloc_tag_set(struct nvme_ctrl *nctrl)
|
||||||
|
{
|
||||||
|
struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
|
||||||
|
struct blk_mq_tag_set *set = &ctrl->tag_set;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
memset(set, 0, sizeof(*set));
|
||||||
|
set->ops = &nvme_tcp_mq_ops;
|
||||||
|
set->queue_depth = nctrl->sqsize + 1;
|
||||||
|
set->reserved_tags = NVMF_RESERVED_TAGS;
|
||||||
|
set->numa_node = nctrl->numa_node;
|
||||||
|
set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_BLOCKING;
|
||||||
|
set->cmd_size = sizeof(struct nvme_tcp_request);
|
||||||
|
set->driver_data = ctrl;
|
||||||
|
set->nr_hw_queues = nctrl->queue_count - 1;
|
||||||
|
set->timeout = NVME_IO_TIMEOUT;
|
||||||
|
set->nr_maps = nctrl->opts->nr_poll_queues ? HCTX_MAX_TYPES : 2;
|
||||||
|
ret = blk_mq_alloc_tag_set(set);
|
||||||
|
if (!ret)
|
||||||
|
nctrl->tagset = set;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl)
|
static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl)
|
||||||
@ -1901,11 +1905,9 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (new) {
|
if (new) {
|
||||||
ctrl->tagset = nvme_tcp_alloc_tagset(ctrl, false);
|
ret = nvme_tcp_alloc_tag_set(ctrl);
|
||||||
if (IS_ERR(ctrl->tagset)) {
|
if (ret)
|
||||||
ret = PTR_ERR(ctrl->tagset);
|
|
||||||
goto out_free_io_queues;
|
goto out_free_io_queues;
|
||||||
}
|
|
||||||
|
|
||||||
ret = nvme_ctrl_init_connect_q(ctrl);
|
ret = nvme_ctrl_init_connect_q(ctrl);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -1970,11 +1972,9 @@ static int nvme_tcp_configure_admin_queue(struct nvme_ctrl *ctrl, bool new)
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
if (new) {
|
if (new) {
|
||||||
ctrl->admin_tagset = nvme_tcp_alloc_tagset(ctrl, true);
|
error = nvme_tcp_alloc_admin_tag_set(ctrl);
|
||||||
if (IS_ERR(ctrl->admin_tagset)) {
|
if (error)
|
||||||
error = PTR_ERR(ctrl->admin_tagset);
|
|
||||||
goto out_free_queue;
|
goto out_free_queue;
|
||||||
}
|
|
||||||
|
|
||||||
ctrl->fabrics_q = blk_mq_init_queue(ctrl->admin_tagset);
|
ctrl->fabrics_q = blk_mq_init_queue(ctrl->admin_tagset);
|
||||||
if (IS_ERR(ctrl->fabrics_q)) {
|
if (IS_ERR(ctrl->fabrics_q)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user