diff options
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
| -rw-r--r-- | drivers/scsi/scsi_lib.c | 48 | 
1 files changed, 20 insertions, 28 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2e28e2360c85..ec39acc986d6 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -32,7 +32,7 @@  #include <scsi/scsi_driver.h>  #include <scsi/scsi_eh.h>  #include <scsi/scsi_host.h> -#include <scsi/scsi_transport.h> /* __scsi_init_queue() */ +#include <scsi/scsi_transport.h> /* scsi_init_limits() */  #include <scsi/scsi_dh.h>  #include <trace/events/scsi.h> @@ -635,10 +635,9 @@ static bool scsi_end_request(struct request *req, blk_status_t error,  	if (blk_queue_add_random(q))  		add_disk_randomness(req->q->disk); -	if (!blk_rq_is_passthrough(req)) { -		WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED)); -		cmd->flags &= ~SCMD_INITIALIZED; -	} +	WARN_ON_ONCE(!blk_rq_is_passthrough(req) && +		     !(cmd->flags & SCMD_INITIALIZED)); +	cmd->flags = 0;  	/*  	 * Calling rcu_barrier() is not necessary here because the @@ -1870,7 +1869,6 @@ out_put_budget:  	case BLK_STS_OK:  		break;  	case BLK_STS_RESOURCE: -	case BLK_STS_ZONE_RESOURCE:  		if (scsi_device_blocked(sdev))  			ret = BLK_STS_DEV_RESOURCE;  		break; @@ -1965,42 +1963,36 @@ static void scsi_map_queues(struct blk_mq_tag_set *set)  	blk_mq_map_queues(&set->map[HCTX_TYPE_DEFAULT]);  } -void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) +void scsi_init_limits(struct Scsi_Host *shost, struct queue_limits *lim)  {  	struct device *dev = shost->dma_dev; -	/* -	 * this limit is imposed by hardware restrictions -	 */ -	blk_queue_max_segments(q, min_t(unsigned short, shost->sg_tablesize, -					SG_MAX_SEGMENTS)); +	memset(lim, 0, sizeof(*lim)); +	lim->max_segments = +		min_t(unsigned short, shost->sg_tablesize, SG_MAX_SEGMENTS);  	if (scsi_host_prot_dma(shost)) {  		shost->sg_prot_tablesize =  			min_not_zero(shost->sg_prot_tablesize,  				     (unsigned short)SCSI_MAX_PROT_SG_SEGMENTS);  		BUG_ON(shost->sg_prot_tablesize < shost->sg_tablesize); -		blk_queue_max_integrity_segments(q, shost->sg_prot_tablesize); +		lim->max_integrity_segments = shost->sg_prot_tablesize;  	} -	blk_queue_max_hw_sectors(q, shost->max_sectors); -	blk_queue_segment_boundary(q, shost->dma_boundary); -	dma_set_seg_boundary(dev, shost->dma_boundary); +	lim->max_hw_sectors = shost->max_sectors; +	lim->seg_boundary_mask = shost->dma_boundary; +	lim->max_segment_size = shost->max_segment_size; +	lim->virt_boundary_mask = shost->virt_boundary_mask; +	lim->dma_alignment = max_t(unsigned int, +		shost->dma_alignment, dma_get_cache_alignment() - 1); -	blk_queue_max_segment_size(q, shost->max_segment_size); -	blk_queue_virt_boundary(q, shost->virt_boundary_mask); -	dma_set_max_seg_size(dev, queue_max_segment_size(q)); +	if (shost->no_highmem) +		lim->bounce = BLK_BOUNCE_HIGH; -	/* -	 * Set a reasonable default alignment:  The larger of 32-byte (dword), -	 * which is a common minimum for HBAs, and the minimum DMA alignment, -	 * which is set by the platform. -	 * -	 * Devices that require a bigger alignment can increase it later. -	 */ -	blk_queue_dma_alignment(q, max(4, dma_get_cache_alignment()) - 1); +	dma_set_seg_boundary(dev, shost->dma_boundary); +	dma_set_max_seg_size(dev, shost->max_segment_size);  } -EXPORT_SYMBOL_GPL(__scsi_init_queue); +EXPORT_SYMBOL_GPL(scsi_init_limits);  static const struct blk_mq_ops scsi_mq_ops_no_commit = {  	.get_budget	= scsi_mq_get_budget,  |