Commit 0366c186 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] move max_sectors intitalization fully to scsi_register

Addresses the fixme in scsi_alloc_queue.
parent 5ee62ae2
...@@ -424,8 +424,14 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes) ...@@ -424,8 +424,14 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
shost->use_clustering = shost_tp->use_clustering; shost->use_clustering = shost_tp->use_clustering;
if (!blk_nohighio) if (!blk_nohighio)
shost->highmem_io = shost_tp->highmem_io; shost->highmem_io = shost_tp->highmem_io;
if (!shost_tp->max_sectors) {
shost->max_sectors = shost_tp->max_sectors; /*
* Driver imposes no hard sector transfer limit.
* start at machine infinity initially.
*/
shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
} else
shost->max_sectors = shost_tp->max_sectors;
shost->use_blk_tcq = shost_tp->use_blk_tcq; shost->use_blk_tcq = shost_tp->use_blk_tcq;
spin_lock(&scsi_host_list_lock); spin_lock(&scsi_host_list_lock);
......
...@@ -1249,28 +1249,15 @@ u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost) ...@@ -1249,28 +1249,15 @@ u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
return BLK_BOUNCE_HIGH; return BLK_BOUNCE_HIGH;
} }
request_queue_t *scsi_alloc_queue(struct scsi_device *sdev) struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
{ {
request_queue_t *q; struct Scsi_Host *shost = sdev->host;
struct Scsi_Host *shost; struct request_queue *q = kmalloc(sizeof(*q), GFP_ATOMIC);
q = kmalloc(sizeof(*q), GFP_ATOMIC);
if (!q) if (!q)
return NULL; return NULL;
memset(q, 0, sizeof(*q)); memset(q, 0, sizeof(*q));
/*
* XXX move host code to scsi_register
*/
shost = sdev->host;
if (!shost->max_sectors) {
/*
* Driver imposes no hard sector transfer limit.
* start at machine infinity initially.
*/
shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
}
blk_init_queue(q, scsi_request_fn, &sdev->sdev_lock); blk_init_queue(q, scsi_request_fn, &sdev->sdev_lock);
blk_queue_prep_rq(q, scsi_prep_fn); blk_queue_prep_rq(q, scsi_prep_fn);
...@@ -1281,11 +1268,10 @@ request_queue_t *scsi_alloc_queue(struct scsi_device *sdev) ...@@ -1281,11 +1268,10 @@ request_queue_t *scsi_alloc_queue(struct scsi_device *sdev)
if (!shost->use_clustering) if (!shost->use_clustering)
clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags); clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);
return q; return q;
} }
void scsi_free_queue(request_queue_t *q) void scsi_free_queue(struct request_queue *q)
{ {
blk_cleanup_queue(q); blk_cleanup_queue(q);
kfree(q); kfree(q);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment