Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7677
b: refs/heads/master
c: b21a413
h: refs/heads/master
i:
  7675: 3b9447a
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Aug 8, 2005
1 parent f2ad95b commit 8c45d98
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f03a567054fea4f9d43c50ec91338266c0bd588d
refs/heads/master: b21a41385118f9a6af3cd96ce71090c5ada52eb5
4 changes: 2 additions & 2 deletions trunk/drivers/scsi/advansys.c
Original file line number Diff line number Diff line change
Expand Up @@ -9200,8 +9200,8 @@ asc_prt_scsi_cmnd(struct scsi_cmnd *s)
(unsigned) s->serial_number, s->retries, s->allowed);

printk(
" timeout_per_command %d, timeout_total %d, timeout %d\n",
s->timeout_per_command, s->timeout_total, s->timeout);
" timeout_per_command %d\n",
s->timeout_per_command);

printk(
" scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n",
Expand Down
15 changes: 15 additions & 0 deletions trunk/drivers/scsi/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask)
} else
put_device(&dev->sdev_gendev);

cmd->jiffies_at_alloc = jiffies;
return cmd;
}
EXPORT_SYMBOL(scsi_get_command);
Expand Down Expand Up @@ -798,9 +799,23 @@ static void scsi_softirq(struct softirq_action *h)
while (!list_empty(&local_q)) {
struct scsi_cmnd *cmd = list_entry(local_q.next,
struct scsi_cmnd, eh_entry);
/* The longest time any command should be outstanding is the
* per command timeout multiplied by the number of retries.
*
* For a typical command, this is 2.5 minutes */
unsigned long wait_for
= cmd->allowed * cmd->timeout_per_command;
list_del_init(&cmd->eh_entry);

disposition = scsi_decide_disposition(cmd);
if (disposition != SUCCESS &&
time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) {
dev_printk(KERN_ERR, &cmd->device->sdev_gendev,
"timing out command, waited %ds\n",
wait_for/HZ);
disposition = SUCCESS;
}

scsi_log_completion(cmd, disposition);
switch (disposition) {
case SUCCESS:
Expand Down
8 changes: 6 additions & 2 deletions trunk/include/scsi/scsi_cmnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@ struct scsi_cmnd {
* printk's to use ->pid, so that we can kill this field.
*/
unsigned long serial_number;
/*
* This is set to jiffies as it was when the command was first
* allocated. It is used to time how long the command has
* been outstanding
*/
unsigned long jiffies_at_alloc;

int retries;
int allowed;
int timeout_per_command;
int timeout_total;
int timeout;

unsigned char cmd_len;
unsigned char old_cmd_len;
Expand Down

0 comments on commit 8c45d98

Please sign in to comment.