Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305870
b: refs/heads/master
c: 8d899e7
h: refs/heads/master
v: v3
  • Loading branch information
Mark Lord authored and Jeff Garzik committed May 7, 2012
1 parent c81f8c4 commit 3bc7820
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 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: cd006086fa5d91414d8ff9ff2b78fbb593878e3c
refs/heads/master: 8d899e70c1b3afff04104eebc09a629ac8dd4b32
24 changes: 21 additions & 3 deletions trunk/drivers/ata/libata-eh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2046,6 +2046,26 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
return action;
}

/**
* ata_eh_worth_retry - analyze error and decide whether to retry
* @qc: qc to possibly retry
*
* Look at the cause of the error and decide if a retry
* might be useful or not. We don't want to retry media errors
* because the drive itself has probably already taken 10-30 seconds
* doing its own internal retries before reporting the failure.
*/
static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc)
{
if (qc->flags & AC_ERR_MEDIA)
return 0; /* don't retry media errors */
if (qc->flags & ATA_QCFLAG_IO)
return 1; /* otherwise retry anything from fs stack */
if (qc->err_mask & AC_ERR_INVALID)
return 0; /* don't retry these */
return qc->err_mask != AC_ERR_DEV; /* retry if not dev error */
}

/**
* ata_eh_link_autopsy - analyze error and determine recovery action
* @link: host link to perform autopsy on
Expand Down Expand Up @@ -2120,9 +2140,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);

/* determine whether the command is worth retrying */
if (qc->flags & ATA_QCFLAG_IO ||
(!(qc->err_mask & AC_ERR_INVALID) &&
qc->err_mask != AC_ERR_DEV))
if (ata_eh_worth_retry(qc))
qc->flags |= ATA_QCFLAG_RETRY;

/* accumulate error info */
Expand Down

0 comments on commit 3bc7820

Please sign in to comment.