Commit 3e0f6303 authored by Doug Ledford's avatar Doug Ledford

[PATCH] two driver updates, one core update

Rename queue_depth to current_queue_depth so that:

A) we represent the true purpose of the variable
B) we catch anyone using it wrongly
parent ca07380f
......@@ -8432,7 +8432,7 @@ asc_prt_driver_conf(struct Scsi_Host *shp, char *cp, int cplen)
continue;
}
len = asc_prt_line(cp, leftlen, " %X:%d",
i, boardp->device[i]->queue_depth);
i, boardp->device[i]->current_queue_depth);
ASC_PRT_NEXT();
}
len = asc_prt_line(cp, leftlen, "\n");
......
......@@ -1530,7 +1530,7 @@ static inline int do_qcomm(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
cpp->mess[1] = SCpnt->device->current_tag++;
}
if (SCpnt->device->queue_depth > 2 && !SCpnt->device->simple_tags) {
if (SCpnt->device->new_queue_depth > 2 && !SCpnt->device->simple_tags) {
HD(j)->cp_stat[i] = READY;
flush_dev(SCpnt->device, SCpnt->request->sector, j, FALSE);
return 0;
......@@ -2040,7 +2040,7 @@ static inline void ihdlr(int irq, unsigned int j) {
sync_dma(i, j);
if (linked_comm && SCpnt->device->queue_depth > 2
if (linked_comm && SCpnt->device->new_queue_depth > 2
&& TLDEV(SCpnt->device->type))
flush_dev(SCpnt->device, SCpnt->request->sector, j, TRUE);
......
......@@ -266,14 +266,6 @@ typedef struct SHT
*/
int (* bios_param)(Disk *, struct block_device *, int []);
/*
* Used to set the queue depth for a specific device.
*
* Once the slave_attach() function is in full use, this will go away.
*/
void (*select_queue_depths)(struct Scsi_Host *, Scsi_Device *);
/*
* This determines if we will use a non-interrupt driven
* or an interrupt driven scheme, It is set to the maximum number
......
......@@ -1820,7 +1820,7 @@ qla1280_slave_attach(Scsi_Device * device)
/* device->queue_depth = 20; */
printk(KERN_INFO "scsi(%li:%d:%d:%d): Enabled tagged queuing, "
"queue depth %d.\n", p->host_no, device->channel,
device->id, device->lun, device->queue_depth);
device->id, device->lun, device->new_queue_depth);
} else {
scsi_adjust_queue_depth(device, 0 /* TCQ off */, 3);
}
......
......@@ -568,7 +568,7 @@ inline void __scsi_release_command(Scsi_Cmnd * SCpnt)
atomic_read(&SCpnt->host->host_active),
SCpnt->host->host_failed));
if(SDpnt->queue_depth > SDpnt->new_queue_depth) {
if(SDpnt->current_queue_depth > SDpnt->new_queue_depth) {
Scsi_Cmnd *prev, *next;
/*
* Release the command block and decrement the queue
......@@ -582,10 +582,10 @@ inline void __scsi_release_command(Scsi_Cmnd * SCpnt)
else
prev->next = next->next;
kfree((char *)SCpnt);
SDpnt->queue_depth--;
} else if(SDpnt->queue_depth < SDpnt->new_queue_depth) {
SDpnt->current_queue_depth--;
} else if(SDpnt->current_queue_depth < SDpnt->new_queue_depth) {
alloc_cmd = 1;
SDpnt->queue_depth++;
SDpnt->current_queue_depth++;
}
spin_unlock_irqrestore(&device_request_lock, flags);
......@@ -633,7 +633,7 @@ inline void __scsi_release_command(Scsi_Cmnd * SCpnt)
spin_unlock_irqrestore(&device_request_lock, flags);
} else {
spin_lock_irqsave(&device_request_lock, flags);
SDpnt->queue_depth--;
SDpnt->current_queue_depth--;
spin_unlock_irqrestore(&device_request_lock, flags);
}
}
......@@ -1509,7 +1509,7 @@ void scsi_release_commandblocks(Scsi_Device * SDpnt)
SDpnt->device_queue = SCnext = SCpnt->next;
kfree((char *) SCpnt);
}
SDpnt->queue_depth = 0;
SDpnt->current_queue_depth = 0;
SDpnt->new_queue_depth = 0;
spin_unlock_irqrestore(&device_request_lock, flags);
}
......@@ -1533,7 +1533,7 @@ void scsi_build_commandblocks(Scsi_Device * SDpnt)
unsigned long flags;
Scsi_Cmnd *SCpnt;
if (SDpnt->queue_depth != 0)
if (SDpnt->current_queue_depth != 0)
return;
SCpnt = (Scsi_Cmnd *) kmalloc(sizeof(Scsi_Cmnd), GFP_ATOMIC |
......@@ -1571,7 +1571,7 @@ void scsi_build_commandblocks(Scsi_Device * SDpnt)
spin_lock_irqsave(&device_request_lock, flags);
if(SDpnt->new_queue_depth == 0)
SDpnt->new_queue_depth = 1;
SDpnt->queue_depth++;
SDpnt->current_queue_depth++;
SCpnt->next = SDpnt->device_queue;
SDpnt->device_queue = SCpnt;
spin_unlock_irqrestore(&device_request_lock, flags);
......@@ -1601,12 +1601,13 @@ void scsi_build_commandblocks(Scsi_Device * SDpnt)
*
* If cmdblocks != 0 then we are a live device. We just set the
* new_queue_depth variable and when the scsi completion handler
* notices that queue_depth != new_queue_depth it will work to
* rectify the situation. If new_queue_depth is less than current
* queue_depth, then it will free the completed command instead of
* putting it back on the free list and dec queue_depth. Otherwise
* it will try to allocate a new command block for the device and
* put it on the free list along with the command that is being
* notices that current_queue_depth != new_queue_depth it will
* work to rectify the situation. If new_queue_depth is less than
* current_queue_depth, then it will free the completed command
* instead of putting it back on the free list and dec
* current_queue_depth. Otherwise it will try to allocate a new
* command block for the device and put it on the free list along
* with the command that is being
* completed. Obviously, if the device isn't doing anything then
* neither is this code, so it will bring the devices queue depth
* back into line when the device is actually being used. This
......@@ -1652,14 +1653,11 @@ void scsi_adjust_queue_depth(Scsi_Device *SDpnt, int tagged, int tags)
SDpnt->channel, SDpnt->id, SDpnt->lun);
case 0:
SDpnt->ordered_tags = SDpnt->simple_tags = 0;
if(SDpnt->host->cmd_per_lun)
SDpnt->new_queue_depth = SDpnt->host->cmd_per_lun;
else
SDpnt->new_queue_depth = 1;
SDpnt->new_queue_depth = tags;
break;
}
spin_unlock_irqrestore(&device_request_lock, flags);
if(SDpnt->queue_depth == 0)
if(SDpnt->current_queue_depth == 0)
{
scsi_build_commandblocks(SDpnt);
}
......@@ -2120,7 +2118,7 @@ int scsi_register_host(Scsi_Host_Template * tpnt)
(*sdtpnt->attach) (SDpnt);
if (SDpnt->attached) {
scsi_build_commandblocks(SDpnt);
if (SDpnt->queue_depth == 0)
if (SDpnt->current_queue_depth == 0)
out_of_space = 1;
}
}
......@@ -2409,10 +2407,10 @@ int scsi_register_device(struct Scsi_Device_Template *tpnt)
* If this driver attached to the device, and don't have any
* command blocks for this device, allocate some.
*/
if (SDpnt->attached && SDpnt->queue_depth == 0) {
if (SDpnt->attached && SDpnt->current_queue_depth == 0) {
SDpnt->online = TRUE;
scsi_build_commandblocks(SDpnt);
if (SDpnt->queue_depth == 0)
if (SDpnt->current_queue_depth == 0)
out_of_space = 1;
}
}
......@@ -2820,7 +2818,7 @@ Scsi_Device * scsi_get_host_dev(struct Scsi_Host * SHpnt)
SDpnt->new_queue_depth = 1;
scsi_build_commandblocks(SDpnt);
if(SDpnt->queue_depth == 0) {
if(SDpnt->current_queue_depth == 0) {
kfree(SDpnt);
return NULL;
}
......
......@@ -568,7 +568,7 @@ struct scsi_device {
struct list_head busy_cmnds; /* list of Scsi_Cmnd structs in use */
Scsi_Cmnd *device_queue; /* queue of SCSI Command structures */
Scsi_Cmnd *current_cmnd; /* currently active command */
unsigned short queue_depth; /* How deep of a queue we have */
unsigned short current_queue_depth;/* How deep of a queue we have */
unsigned short new_queue_depth; /* How deep of a queue we want */
unsigned int id, lun, channel;
......
......@@ -1482,13 +1482,6 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
printk(KERN_INFO "%s: scsi_add_lun: failed low level driver attach, setting device offline", devname);
sdev->online = FALSE;
}
/*
* For untagged devices, did the lldd set the untagged queue
* depth?
*/
if(sdev->tagged_supported == 0 &&
sdev->new_queue_depth != sdev->host->cmd_per_lun)
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
} else if(sdev->host->cmd_per_lun) {
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
}
......@@ -1539,7 +1532,7 @@ static int scsi_probe_and_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
*/
sdevscan->new_queue_depth = 1;
scsi_build_commandblocks(sdevscan);
if (sdevscan->queue_depth == 0)
if (sdevscan->current_queue_depth == 0)
goto alloc_failed;
sreq = scsi_allocate_request(sdevscan);
......@@ -1613,7 +1606,7 @@ static int scsi_probe_and_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
kfree(scsi_result);
if (sreq != NULL)
scsi_release_request(sreq);
if (sdevscan->queue_depth != 0)
if (sdevscan->current_queue_depth != 0)
scsi_release_commandblocks(sdevscan);
return SCSI_SCAN_NO_RESPONSE;
}
......@@ -1769,7 +1762,7 @@ static int scsi_report_lun_scan(Scsi_Device *sdevscan)
sdevscan->new_queue_depth = 1;
scsi_build_commandblocks(sdevscan);
if (sdevscan->queue_depth == 0) {
if (sdevscan->current_queue_depth == 0) {
printk(ALLOC_FAILURE_MSG, __FUNCTION__);
/*
* We are out of memory, don't try scanning any further.
......@@ -2037,7 +2030,7 @@ static void scsi_scan_selected_lun(struct Scsi_Host *shost, uint channel,
(*sdt->attach) (sdev);
if (sdev->attached) {
scsi_build_commandblocks(sdev);
if (sdev->queue_depth == 0)
if (sdev->current_queue_depth == 0)
printk(ALLOC_FAILURE_MSG,
__FUNCTION__);
}
......
......@@ -852,7 +852,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
__put_user((int) sdp->device->type, &sg_idp->scsi_type);
__put_user((short) sdp->device->host->cmd_per_lun,
&sg_idp->h_cmd_per_lun);
__put_user((short) sdp->device->queue_depth,
__put_user((short) sdp->device->new_queue_depth,
&sg_idp->d_queue_depth);
__put_user(0, &sg_idp->unused[0]);
__put_user(0, &sg_idp->unused[1]);
......@@ -3039,7 +3039,7 @@ sg_proc_dev_info(char *buffer, int *len, off_t * begin, off_t offset, int size)
scsidp->host->host_no, scsidp->channel,
scsidp->id, scsidp->lun, (int) scsidp->type,
(int) scsidp->access_count,
(int) scsidp->queue_depth,
(int) scsidp->new_queue_depth,
(int) scsidp->device_busy,
(int) scsidp->online);
else
......
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