* [PATCH 6/6] scsi-mq: Pre-allocation of sg tables base on min(host->hostt->sg_tablesize,SCSI_MQ_MAX_SG_SEGMENTS).
@ 2013-11-29 8:42 majianpeng
2013-12-23 6:33 ` Nicholas A. Bellinger
0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2013-11-29 8:42 UTC (permalink / raw)
To: nab; +Cc: linux-scsi
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
drivers/scsi/scsi-mq.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/scsi-mq.c b/drivers/scsi/scsi-mq.c
index 78b05c1..7b8137b 100644
--- a/drivers/scsi/scsi-mq.c
+++ b/drivers/scsi/scsi-mq.c
@@ -154,6 +154,7 @@ int scsi_mq_alloc_queue(struct Scsi_Host *sh, struct scsi_device *sdev)
struct request *rq;
struct scsi_cmnd *sc;
int i, j;
+ int sgl_size;
sdev->sdev_mq_reg.ops = &scsi_mq_ops;
sdev->sdev_mq_reg.queue_depth = min((short)sh->hostt->can_queue,
@@ -186,13 +187,20 @@ int scsi_mq_alloc_queue(struct Scsi_Host *sh, struct scsi_device *sdev)
* Set existing Scsi_Host based hardware limits from scsi_lib.c
*/
scsi_init_request_queue(q, sh);
+
+ if (sh->hostt->sg_tablesize > SCSI_MQ_MAX_SG_SEGMENTS) {
+ printk(KERN_ERR"Host%d sg_tablesize too larger than %d\n",
+ sh->host_no, SCSI_MQ_MAX_SG_SEGMENTS);
+ sh->hostt->sg_tablesize = SCSI_MQ_MAX_SG_SEGMENTS;
+ }
+ sgl_size = sh->hostt->sg_tablesize * sizeof(struct scatterlist);
+
/*
* Do remaining setup of pre-allocated scsi_cmnd descriptor map for
* each scsi-mq hctx
*/
//FIXME: Do cmd->prot_sdb setup for DIF from scsi_host_alloc_command
queue_for_each_hw_ctx(q, hctx, i) {
-
printk("Performing sc map setup on q: %p hctx: %p i: %d\n", q, hctx, i);
for (j = 0; j < hctx->queue_depth; j++) {
@@ -201,8 +209,7 @@ int scsi_mq_alloc_queue(struct Scsi_Host *sh, struct scsi_device *sdev)
sc->device = sdev;
sc->ll_list.next = NULL;
-//FIXME: Pre-allocation of sg tables based upon max_sectors
- sc->mq_sgl = kzalloc_node(SCSI_MQ_SGL_SIZE,
+ sc->mq_sgl = kzalloc_node(sgl_size,
GFP_KERNEL, sdev->sdev_mq_reg.numa_node);
if (!sc->mq_sgl) {
pr_err("Unable to pre-allocate sc->sdb\n");
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 6/6] scsi-mq: Pre-allocation of sg tables base on min(host->hostt->sg_tablesize,SCSI_MQ_MAX_SG_SEGMENTS).
2013-11-29 8:42 [PATCH 6/6] scsi-mq: Pre-allocation of sg tables base on min(host->hostt->sg_tablesize,SCSI_MQ_MAX_SG_SEGMENTS) majianpeng
@ 2013-12-23 6:33 ` Nicholas A. Bellinger
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2013-12-23 6:33 UTC (permalink / raw)
To: majianpeng; +Cc: linux-scsi
On Fri, 2013-11-29 at 16:42 +0800, majianpeng wrote:
> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
> ---
> drivers/scsi/scsi-mq.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
Applied, + squashed into current target-pending/scsi-mq code.
Thanks Jianpeng!
--nab
> diff --git a/drivers/scsi/scsi-mq.c b/drivers/scsi/scsi-mq.c
> index 78b05c1..7b8137b 100644
> --- a/drivers/scsi/scsi-mq.c
> +++ b/drivers/scsi/scsi-mq.c
> @@ -154,6 +154,7 @@ int scsi_mq_alloc_queue(struct Scsi_Host *sh, struct scsi_device *sdev)
> struct request *rq;
> struct scsi_cmnd *sc;
> int i, j;
> + int sgl_size;
>
> sdev->sdev_mq_reg.ops = &scsi_mq_ops;
> sdev->sdev_mq_reg.queue_depth = min((short)sh->hostt->can_queue,
> @@ -186,13 +187,20 @@ int scsi_mq_alloc_queue(struct Scsi_Host *sh, struct scsi_device *sdev)
> * Set existing Scsi_Host based hardware limits from scsi_lib.c
> */
> scsi_init_request_queue(q, sh);
> +
> + if (sh->hostt->sg_tablesize > SCSI_MQ_MAX_SG_SEGMENTS) {
> + printk(KERN_ERR"Host%d sg_tablesize too larger than %d\n",
> + sh->host_no, SCSI_MQ_MAX_SG_SEGMENTS);
> + sh->hostt->sg_tablesize = SCSI_MQ_MAX_SG_SEGMENTS;
> + }
> + sgl_size = sh->hostt->sg_tablesize * sizeof(struct scatterlist);
> +
> /*
> * Do remaining setup of pre-allocated scsi_cmnd descriptor map for
> * each scsi-mq hctx
> */
> //FIXME: Do cmd->prot_sdb setup for DIF from scsi_host_alloc_command
> queue_for_each_hw_ctx(q, hctx, i) {
> -
> printk("Performing sc map setup on q: %p hctx: %p i: %d\n", q, hctx, i);
>
> for (j = 0; j < hctx->queue_depth; j++) {
> @@ -201,8 +209,7 @@ int scsi_mq_alloc_queue(struct Scsi_Host *sh, struct scsi_device *sdev)
> sc->device = sdev;
> sc->ll_list.next = NULL;
>
> -//FIXME: Pre-allocation of sg tables based upon max_sectors
> - sc->mq_sgl = kzalloc_node(SCSI_MQ_SGL_SIZE,
> + sc->mq_sgl = kzalloc_node(sgl_size,
> GFP_KERNEL, sdev->sdev_mq_reg.numa_node);
> if (!sc->mq_sgl) {
> pr_err("Unable to pre-allocate sc->sdb\n");
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-23 6:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29 8:42 [PATCH 6/6] scsi-mq: Pre-allocation of sg tables base on min(host->hostt->sg_tablesize,SCSI_MQ_MAX_SG_SEGMENTS) majianpeng
2013-12-23 6:33 ` Nicholas A. Bellinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).