Re: [PATCH 6/6] scsi-mq: Pre-allocation of sg tables base on min(host->hostt->sg_tablesize,SCSI_MQ_MAX_SG_SEGMENTS).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2013-11-29 at 16:42 +0800, majianpeng wrote:
> Signed-off-by: Jianpeng Ma <majianpeng@xxxxxxxxx>
> ---
>  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");


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux