Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH v2] libata: skip old error history when counting probe trials
@ 2012-05-03 14:15 Lin Ming
  2012-05-04 15:12 ` Gwendal Grignou
  0 siblings, 1 reply; 2+ messages in thread
From: Lin Ming @ 2012-05-03 14:15 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Sergei Shtylyov, linux-ide, Martin Mokrejs, Grant Grundler,
	Gwendal Grignou

Commit d902747("[libata] Add ATA transport class") introduced
ATA_EFLAG_OLD_ER to mark entries in the error ring as cleared.

But ata_count_probe_trials_cb() didn't check this flag and it still
counts the old error history. So wrong probe trials count is returned
and it causes problem, for example, SATA link speed is slowed down from
3.0Gbps to 1.5Gbps.

Fix it by checking ATA_EFLAG_OLD_ER in ata_count_probe_trials_cb().

Cc: stable <stable@vger.kernel.org> # 2.6.37+
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
---

v2: update logs, specify the summary of commit d902747

 drivers/ata/libata-eh.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index c61316e..d1fbd59 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3501,7 +3501,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg
 	u64 now = get_jiffies_64();
 	int *trials = void_arg;
 
-	if (ent->timestamp < now - min(now, interval))
+	if ((ent->eflags & ATA_EFLAG_OLD_ER) ||
+	    (ent->timestamp < now - min(now, interval)))
 		return -1;
 
 	(*trials)++;
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] libata: skip old error history when counting probe trials
  2012-05-03 14:15 [PATCH v2] libata: skip old error history when counting probe trials Lin Ming
@ 2012-05-04 15:12 ` Gwendal Grignou
  0 siblings, 0 replies; 2+ messages in thread
From: Gwendal Grignou @ 2012-05-04 15:12 UTC (permalink / raw)
  To: Lin Ming
  Cc: Jeff Garzik, Sergei Shtylyov, linux-ide, Martin Mokrejs,
	Grant Grundler

On Thu, May 3, 2012 at 7:15 AM, Lin Ming <ming.m.lin@intel.com> wrote:
> Commit d902747("[libata] Add ATA transport class") introduced
> ATA_EFLAG_OLD_ER to mark entries in the error ring as cleared.
>
> But ata_count_probe_trials_cb() didn't check this flag and it still
> counts the old error history. So wrong probe trials count is returned
> and it causes problem, for example, SATA link speed is slowed down from
> 3.0Gbps to 1.5Gbps.
>
> Fix it by checking ATA_EFLAG_OLD_ER in ata_count_probe_trials_cb().
>
> Cc: stable <stable@vger.kernel.org> # 2.6.37+
> Signed-off-by: Lin Ming <ming.m.lin@intel.com>
> ---
>
> v2: update logs, specify the summary of commit d902747
>
>  drivers/ata/libata-eh.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
> index c61316e..d1fbd59 100644
> --- a/drivers/ata/libata-eh.c
> +++ b/drivers/ata/libata-eh.c
> @@ -3501,7 +3501,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg
>        u64 now = get_jiffies_64();
>        int *trials = void_arg;
>
> -       if (ent->timestamp < now - min(now, interval))
> +       if ((ent->eflags & ATA_EFLAG_OLD_ER) ||
> +           (ent->timestamp < now - min(now, interval)))
>                return -1;
>
>        (*trials)++;
> --
> 1.7.9
>

Acked-by: Gwendal Grignou <gwendal@google.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-04 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-03 14:15 [PATCH v2] libata: skip old error history when counting probe trials Lin Ming
2012-05-04 15:12 ` Gwendal Grignou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox